Socket.IO – Chat Application
Now that we are well acquainted with Socket.IO, let us write a chat application, which we can use to chat on different chat rooms. We will allow users to choose…
Socket.IO
Now that we are well acquainted with Socket.IO, let us write a chat application, which we can use to chat on different chat rooms. We will allow users to choose…
In this chapter, we will discuss regarding Fallbacks, Connection using Socket.IO, Events and Messages. Fallbacks Socket.IO has a lot of underlying transport mechanisms, which deal with various constraints arising due…
Socket.IO uses a very famous debugging module developed by ExpresJS's main author, called debug. Earlier Socket.IO used to log everything to the console making it quite difficult to debug the…
We have worked on local servers until now, which will almost never give us errors related to connections, timeouts, etc. However, in real life production environments, handling such errors are…
Within each namespace, you can also define arbitrary channels that sockets can join and leave. These channels are called rooms. Rooms are used to further-separate concerns. Rooms also share the…
Socket.IO allows you to "namespace" your sockets, which essentially means assigning different endpoints or paths. This is a useful feature to minimize the number of resources (TCP connections) and at…
Broadcasting means sending a message to all connected clients. Broadcasting can be done at multiple levels. We can send the message to all the connected clients, to clients on a…
Sockets work based on events. There are some reserved events, which can be accessed using the socket object on the server-side. These are − ConnectMessageDisconnectReconnectPingJoin andLeave. The client-side socket object…
In the following chapter, we will discuss the basic example using the Socket.IO library along with ExpressJS. Example First of all, create a file called app.js and enter the following code to…
To get started with developing using the Socket.IO, you need to have Node and npm (node package manager) installed. If you do not have these, head over to Node setup to install node on your local system.…