Skip to content

AliGhasami/sample-websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebSocket Server Example

A Node.js WebSocket server that sends a message every second after a connection is established.

Installation

npm install

Running the Server

npm start

The server will start on ws://localhost:8080

Testing

  1. Open client.html in your web browser
  2. Click the "Connect" button
  3. You will see messages arriving every second

How it Works

  • When a client connects, the server sends a welcome message
  • Then it starts sending messages every second (1000ms interval)
  • Each message includes a timestamp and a heartbeat message
  • The interval is automatically cleaned up when the client disconnects

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors