/// <summary> /// Creates the server. Will override old servers. /// </summary> /// <param name="address">If != null then use this addres (changes the address of the websocket pipe)</param> public void MakeServer(Uri address = null) { if (address == null) { address = Address; } // Stop the old if any. if (WSServer != null && WSServer.IsListening) { WSServer.Stop(); } string serverURL = address.Scheme + "://" + address.Host + ":" + Address.Port; WSServer = new WebSocketSharp.Server.WebSocketServer(serverURL); // Creates a server. WSServer.AddWebSocketService <WebsocketConnection>( address.AbsolutePath, () => new WebsocketConnection(this)); WSServer.Log.Output = (d, s) => WebsocketLogMessage(null, d.ToString()); if (m_WaitTimeout == null) { m_WaitTimeout = WSServer.WaitTime; } else { WSServer.WaitTime = WaitTimeout; } }
void InitNetwork() { WSServerState.Reset(); if (DebugStandalone) { WSServer.Stop(); WSServerState.Reset(); WSClient.Disconnect(); WSClientState.Reset(); WSServer.StartFake(); WSClient.ConnectFake(); } else if (IsClient) { WSServer.Stop(); WSServerState.Reset(); WSClient.Connect(); } else { WSClient.Disconnect(); WSClientState.Reset(); if (!WSServer.IsRunning) { WSServer.Start(); } } }
public void OnDestroy() { WebRTC.Finalize(); Audio.Stop(); ws = null; wss.Stop(); }
public void Stop() { if (_alchemy != null) { _alchemy.Stop(); _alchemy = null; } }
/// <summary> /// Stops listening to remote connections. /// </summary> public void StopListening() { if (WS != null) { throw new Exception("Cannot both be a server and a client." + " Please use Disconnect if you are diconnecting from a server or StopListening to stop the server."); } if (WSServer == null) { return; } if (WSServer.IsListening) { WSServer.Stop(); } DataSocket.Close(); }
public void Dispose() { if (WS != null && WS.IsAlive) { WS.Close(); } if (WSServer != null && WSServer.IsListening) { WSServer.Stop(); } if (DataSocket != null) { DataSocket.Close(); } WS = null; WSServer = null; DataSocket = null; Serializer = null; }
void OnApplicationQuit() { WSServer.Stop(); WSClient.Disconnect(); }
private void StopServer() { httpServer.Stop(); wsServer.Stop(); }
public void Stop() { _wsServer.Stop(); }
public void Stop() { httpService.Stop(); wsService.Stop(); }