title: How to set Websocket-sharp connection between WPF app and ASP.Net app?
body: <p>I have a desktop application (WPF) and a web application (ASP.Net) and want to set connection using WebSocket-Sharp. </p>
  
  <p>On client side:</p>
  
  <pre><code>        using (var ws = new WebSocket("ws://localhost:8085"))
          {
              var data = new byte[] { 1, 2, 3, 4, 5 };
              ws.OnMessage += (send, args) =&gt;
              {
                  Status = "WebSocket. OnMessageEvent!";
              };
  
              ws.Connect();
  
              if (ws.IsAlive)
              {
                  ws.Send(data);
              }
  
              ws.Close();
          }
  </code></pre>
  
  <p>On server side:</p>
  
  <pre><code>        var wssv = new WebSocketSharp.Server.WebSocketServer("ws://localhost:8085");
  
          wssv.Start();
  
          wssv.AddWebSocketService&lt;Chat&gt;("/Chat");
  </code></pre>
  
  <p>Chat is a class that inherites WebSocketBehavior class.</p>
  
  <p>There are two questions:</p>
  
  <ol>
  <li><p>How to identify right place to put code on server side?</p></li>
  <li><p>Should a port that I set in IIS to be different from WebSocket? May I set any port to WebSocket?</p></li>
  </ol>
  
  <p>Thank you!</p>