WebSocket chat in Next.js
npx create-next-app chat-app
Setup websocket
npm install socket.io
create > socket.io file in > pages/api/
// socket.js
import { Server } from 'Socket.IO'
const SocketHandler = (req, res) => {
if (res.socket.server.io) {
console.log('Socket ...
mandeepsingh.hashnode.dev1 min read
Emeka Elo-Chukwuma
Frontend developer
Well, this feels more like a websocket usecase of real-time collaboration. The input field being a wide textarea or some WYSIWYG. Nice π