示例#1
0
 private void CloseConnection(int code, String reason)
 {
     if (IsConnected())
     {
         _connection.Close(code, reason);
     }
     OnDisconnect(new EventArgs());
 }
 public void Close()
 {
     if (!Closed && !Closing)
     {
         Closing = true;
         if (_connection != null && !_connection.Closed)
         {
             _connection.Close(WebSocketCloseCode.Normal);
         }
         Closing = false;
         Closed  = true;
     }
 }