Sitelet https://github.com/feuyeux/hello-websocket/tree/main/hello-websocket-nodejs
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Hello WebSocket - Node.js Implementation

Node.js implementation of the Hello WebSocket protocol using ws.

Project Structure

hello-websocket-nodejs/
├── package.json            # npm package definition
├── common/
│   ├── codec.js            # Binary protocol codec
│   └── codec.test.js       # Codec unit tests
├── server/
│   └── ws_server.js        # WebSocket server
├── client/
│   └── ws_client.js        # WebSocket client
├── scripts/
│   ├── build.sh            # Install and test
│   ├── run-server.sh       # Run server
│   └── run-client.sh       # Run client
└── README.md

Prerequisites

  • Node.js 18+

Build

./scripts/build.sh

Or manually:

npm install
npm test

Run Server

./scripts/run-server.sh

Environment variables:

  • WS_PORT — Port to listen on (default: 9898)
  • WS_PATH — WebSocket path (default: /ws)

Run Client

./scripts/run-client.sh

Environment variables:

  • WS_SERVER — Server host (default: 127.0.0.1)
  • WS_PORT — Server port (default: 9898)
  • WS_PATH — WebSocket path (default: /ws)

Protocol

See ../PROTOCOL.md for the canonical protocol specification.