---
title: "Discussion on \"WebSocket chat in Next.js\" | Hashnode"
description: "Discussion on \"WebSocket chat in Next.js\". npx create-next-app chat-app\nSetup websocket \nnpm install socket.io\ncreate > socket.io file in  > pages/api/\n// socket.js\nimport { Server } from 'Socket.IO'\n\nconst SocketHandler = (req, res) => {\n  if (res.socket.server.io) {\n    console.log('Socket ..."
url: "https://hashnode.com/posts/websocket-chat-in-nextjs/6273783d19a4772a6c29bc32"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [WebSocket chat in Next.js](https://mandeepsingh.hashnode.dev/websocket-chat-in-nextjs?utm_source=hashnode&utm_medium=feed)

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 ...

May 5, 2022 · 1 min read · mandeepsingh.hashnode.dev  
Updated May 10, 2022  
Read the article

-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#websockets](https://hashnode.com/tag/websockets)

## Written by

[Mandeep Singh](https://hashnode.com/@mandeepsingh)

@mandeepsingh · Machhiwara Sahib, India

  
[View profile](https://hashnode.com/@mandeepsingh)

Code Repeat Repeat

I am Mandeep Singh, a full-stack developer. I created this Blog to bestow my coding experience and love to write on JavaScript, Next.js, Laravel and little bit Unity Game development.

## Responses 1

Markdown supported · ⌘↵ to post

[Emeka Elo-Chukwuma](https://hashnode.com/@BrunoElo)

[Jun 3, 2022](https://hashnode.com/posts/websocket-chat-in-nextjs/6273783d19a4772a6c29bc32/comment/62998669a5004f19f574e0e7)

Well, this feels more like a websocket usecase of real-time collaboration. The input field being a wide textarea or some WYSIWYG. Nice 👍
