Angular + WebSocket + Node.js Express = RxJS WebSocketSubject ❤️

A simple Angular client based on the shining RxJS WebSocketSubject

Jonny Fox
Factory Mind

--

UPDATE -> Repo working with rxjs 6 and Angular 6

Given the wide interest in my previous article on WebSocket, Node and Express (thanks to everyone 😅) I created a simple Angular client that allows you to communicate with the server made in the previous tutorial (PS: I also updated the libraries related to the server component 🎉).

This mini-project (source code here and working DEMO here🎠 — try to open two or more browser windows and play with the broadcast button) can be summarized in the following code snippet:

As you can see, we are initializing a WebSocketSubject and specifying the type of object we intend to obtain from the server (in this case, simply a Message).

Obviously, the definition of the obtained object must conform to what is communicated by the server…

--

--