Grokking ExpressJS
0% completed
Setting Up WebSocket Servers with Express.js
Express handles HTTP requests, and the ws library handles WebSocket connections, but the task app should not need two ports for them. The echo server from the previous lesson opened a separate port, 8080. This lesson puts the WebSocket server on the same port as the Express routes and turns the echo into a project chat that forwards each message to every other connected user.
One Port for Both
Express has no WebSocket support of its own. What makes sharing possible is the handshake: a WebSocket connection starts as an HTTP request, so one Node
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%