<tech> brunch ;

Angular Chat Application using Socket.IO

Socket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server. It consists of: a Node.js server: Source.

Socket.IO is NOT a WebSocket implementation. Although Socket.IO indeed uses WebSocket as a transport when possible, it adds some metadata to each packet: the packet type, the namespace and the ack id when a message acknowledgement is needed. That is why a WebSocket client will not be able to successfully connect to a Socket.IO server, and a Socket.IO client will not be able to connect to a WebSocket server either.

Flow Diagram

I wrote a backend node server, where I used Socket.io library to listen and emit messages. The main idea was to separate the emitted messages/received messages logic in such a way that client-server architecture is easily representable. Moreover, though I could have implemented logging also at server side, but as of now I have kept it as the future scope for this project. =D

Find the code for Chat server here:

I used Angular 5 to make the front end, and to communicate with Node Chat Server using Socket.IO.

This simple example gives ability to test and implement the feature like ‘Observables’/‘Subscribe’ in Angular.

Find the code for Chat client here: