HTML and CSS Reference
In-Depth Information
There are a number of open-source websocket server implementations. This article provides
links to several of these that you might want to consider for future reference:
http://stackoverflow.com/questions/1530023/do-i-need-a-server-to-use-html5s-websockets .
These are implemented on various platforms including JavaScript and pHp. Many of them support multiple protocols.
Note
To create a websocket server you will first implement the following capabilities:
Connection handshaking
Listening for messages
Decoding websocket frames
Building and sending a message frame
Once the basic infrastructure is complete, you'll then provide the custom server features needed for your
application. After all, the whole point of websockets is to allow the server to communicate with the client.
Designing the Agent Chat Application
In this chapter you'll build a server and two client applications that will allow agents to chat with multiple clients
simultaneously. An agent will log in and connect to the server using the agent web application, letting the server
know that the agent is ready to accept chat sessions. The agent application will be designed to handle up to
four simultaneous chat sessions. Clients can then use the client web application to connect to the server. Each
client is routed to an available agent and the chat session is started. From this point, the server is just forwarding
messages between the client and the agent. This communication is described in Figure 13-3 .
Handshaking
Handshaking
“Log in”
Request agent
Chat messages
Chat messages
Client
Free agent session
Disconnect
Agent
Figure 13-3. The websocket communication
 
 
Search WWH ::




Custom Search