HTML and CSS Reference
In-Depth Information
socket.OnClose = () =>
{
// Remove the disconnected client
from the list.
clients.Remove(socket);
// Inform the others that someone
left the conversation.
foreach (var client in clients)
{
if (client.ConnectionInfo.Id !=
socket.ConnectionInfo.Id)
{
client.Send("<i>" +
socket.ConnectionInfo.Id + " left the chat
room.</i>");
}
}
};
socket.OnMessage = message =>
{
// Send the message to everyone!
// Also, send the client
connection's unique identifier in order to
recognize who is who.
foreach (var client in clients)
{
client.Send(socket.ConnectionInfo.Id + " says:
<strong>" + message + "</strong>");
}
};
});
// Wait for a key press to close...
Console.ReadLine();
}
Search WWH ::




Custom Search