mjansing / node-express-websocket-example

A simple websocket server example using express and ws.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-express-websocket-example

A simple websocket server example using express and ws.

The server simply replies to all messages with "Reply to <YOUR_MESSAGE>".

Getting started

  1. Clone repo
  2. install dependencies: npm install
  3. start server: npm start

Use browser developer tools for websocket connection and sending messages:

  1. visit http://localhost:3000 and open developer console
  2. ws = new WebSocket('ws://localhost:3000')
  3. ws.send('Hello')
  4. See network tab for messages

Example

About

A simple websocket server example using express and ws.


Languages

Language:JavaScript 100.0%