HTML and CSS Reference
public void Dispose()
if (_connection != null)
The WsClientConnection class is very similar to the WsAgentConnection class. Instead of a Dictionary
of associated clients, it has a single reference to the WsAgentConnection object. This represents the agent
that the client is chatting with. The constructor supplies the underlying WsConnection object, the associated
WsAgentConection object, and the ID by which this client is known. This is used to prefix the message that is
forwarded to the agent.
open the WsServer.cs file and add the code shown in bold. This creates the
collections that will store the agent and client objects.
// This socket listens for new connections
// Configurable port # that is passed in the constructor
// List of connections
public WsServer(int port)
// This is a list of active connections
In the WsServer class, replace the MessageReceived() event handler with the code
shown in Listing 13-10.