Watercooler; A chat app with no websockets needed

Project link on github: https://github.com/CrowdHailer/watercooler

No Websockets?

When viewing this application over https content will be served over a single connection using the HTTP/2 protocol. One of the streams is used to stream server sent events from server to client. At this point both client and server can freely send messages to the other. Bidirectionally communication is achieved using a single TCP connection.

There is a very nice JavaScript API to react to server sent events in the browser. The API in the browser is EventSource (slightly confusing but it has nothing to do with EventSourcing the architecture).

The need for bidirectional communication was the motivation for websockets in HTTP/1.
However because a stream of server sent events can share a connection with other requests from client to server there are very few reasons to keep using websockets with HTTP/2.

23 Likes