We have a static prototype, and now we will make it functional. Any chat requires communication between connected clients. Usually, clients do not connect directly but through a server. The server registers connections and forwards the messages. It's pretty clear how to send a message from the client to server, but can we do it in the opposite direction? In the olden days, we had to deal with long-polling techniques. That worked, but with the overhead of HTTP, it is not really suitable when we mean a low latency application. Luckily for us, Electron supports WebSockets. With that API, we can open a full-duplex, bi-directional TCP connection between the client and server. WebSockets provides higher speed and efficiency ...
Utilizing WebSockets
Get Cross-platform Desktop Application Development: Electron, Node, NW.js, and React now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.