diff --git a/Example2/Chat.cs b/Example2/Chat.cs index a330ad38..68387a7a 100644 --- a/Example2/Chat.cs +++ b/Example2/Chat.cs @@ -24,9 +24,7 @@ namespace Example2 private string getName () { var name = Context.QueryString["name"]; - return !name.IsNullOrEmpty () - ? name - : (_prefix + getNumber ()); + return !name.IsNullOrEmpty () ? name : _prefix + getNumber (); } private static int getNumber () diff --git a/Example2/Echo.cs b/Example2/Echo.cs index f0a087ca..dd780c8d 100644 --- a/Example2/Echo.cs +++ b/Example2/Echo.cs @@ -9,8 +9,7 @@ namespace Example2 protected override void OnMessage (MessageEventArgs e) { var name = Context.QueryString["name"]; - var msg = !name.IsNullOrEmpty () ? String.Format ("'{0}' to {1}", e.Data, name) : e.Data; - Send (msg); + Send (!name.IsNullOrEmpty () ? String.Format ("\"{0}\" to {1}", e.Data, name) : e.Data); } } } diff --git a/Example2/Program.cs b/Example2/Program.cs index 02f003dc..950ffde8 100644 --- a/Example2/Program.cs +++ b/Example2/Program.cs @@ -11,11 +11,11 @@ namespace Example2 { public static void Main (string[] args) { - /* Create a new instance of the WebSocketServer class. - * - * If you would like to provide the secure connection, you should create the instance with - * the 'secure' parameter set to true, or the wss scheme WebSocket URL. - */ + // Create a new instance of the WebSocketServer class. + // + // If you would like to provide the secure connection, you should create the instance with + // the 'secure' parameter set to true, or the wss scheme WebSocket URL. + var wssv = new WebSocketServer (4649); //var wssv = new WebSocketServer (5963, true); //var wssv = new WebSocketServer (System.Net.IPAddress.Parse ("127.0.0.1"), 4649); @@ -62,8 +62,9 @@ namespace Example2 wssv.AddWebSocketService ( "/Chat", () => new Chat ("Anon#") { + // To send the Sec-WebSocket-Protocol header that has a subprotocol name. Protocol = "chat", - // To emit a WebSocket.OnMessage event when receives a Ping. + // To emit a WebSocket.OnMessage event when receives a ping. EmitOnPing = true, // To ignore the Sec-WebSocket-Extensions header. IgnoreExtensions = true,