This project demonstrates a simple WebSocket implementation using Node.js. It includes a WebSocket server and client to establish real-time, bidirectional communication.
- WebSocket server running on
ws://localhost:8080 - Client can send messages to the server
- Server responds to client messages
- Handles multiple connections
- Node.js (v14 or later recommended)
- Clone this repository:
git clone https://github.com/piehostHQ/node-secure-websocket.git cd your-repo-name
Install dependencies:
npm installUsage Start the WebSocket Server Run the server:
node server.jsThe server will start and listen on ws://localhost:8080. Start the WebSocket Client Run the client:
node client.jsEnter messages to send to the server. Example Interaction Client sends a message:
Enter message to send: Hello, Server!
Server logs the message and responds:
Received: Hello, Server!
Client receives the server's response:
Message from server: Server received: Hello, Server!