The complete source code
Here is the complete server-side source code, with a couple of extra additions for better user experience. The screenshots display a Chrome and an Internet Explorer 10 window chatting side-by-side!
The following screenshot shows a user chatting using Chrome:
![](https://static.packt-cdn.com/products/9781782166962/graphics/6962_03_02.jpg)
The following screenshot shows a second user chatting concurrently using Internet Explorer 10:
![](https://static.packt-cdn.com/products/9781782166962/graphics/6962_03_03.jpg)
namespace WebSockets.Server { class Program { static void Main(string[] args) { // Store the subscribed clients. var clients = new List<IWebSocketConnection>(); // Initialize the WebSocket server connection. var server = new WebSocketServer("ws://localhost:8181"); server.Start(socket) => { socket.OnOpen = () => { // Add the incoming connection to our list. clients.Add(socket); // Inform the others that someone has just joined the conversation. foreach (var client in clients) { //...