HTML and CSS Reference
In-Depth Information
Figure 11-4. ElectroServer ports and protocols
where that user can see the messages of other people in the same virtual space. In that
room, the client is “connected” to those other users. However, it is usually not a direct
connection (e.g., peer-to-peer), but instead a connection through a port to a socket
server.
The socket server acts as the traffic cop for the chat messages. It listens on a port (in
our case, 8989) for messages coming in from the clients. Those messages need to be
formatted in a way that the server can understand so it can process them. The JavaScript
API we will use performs this formatting for our client applications.
When the socket server receives a message from the client, it routes the various text
messages sent by each client back out to the other clients in the room. However, it can
also do much more by using server-side processing, such as hold the list of current
messages, so people entering the room while the chat is ongoing can see what has been
said previously, scan chat messages for swear words, award points to users for their
input, or anything else you can dream up.
When the server finally processes the message and sends it back, the client then pro-
cesses that message. In the case of the chat, that processing usually involves displaying
the message on the canvas.
 
Search WWH ::




Custom Search