/// <summary> /// Restarts the servers /// </summary> public void Restart() { lock (_syncRoot) { if (Started) { StopCore(); } LogicServer = new TLogicServer(); StartCore(); Started = true; Log.Info("The server is restarted"); } }
/// <summary> /// Stops the socket server. Sets logic server to instance of the <see cref="TNullLogicServer"/> /// </summary> public void Stop() { lock (_syncRoot) { if (!Started) { return; } Started = false; StopCore(); LogicServer = new TNullLogicServer(); Log.Info("The server is stopped"); } }
/// <summary> /// Starts the socket server. Sets logic server to instance of the <see cref="TLogicServer"/> /// </summary> public void Start() { lock (_syncRoot) { if (Started) { return; } LogicServer = new TLogicServer(); StartCore(); Started = true; Log.Info("The server is started"); } }
public WebSocketApp(Func <IWebSocketConnectionHandler> createConnectionHandler, string address = "127.0.0.1", int port = 5555) { this.createConnectionHandler = createConnectionHandler; handler = this.createConnectionHandler(); this.address = address; this.port = port; this.cancellationTokenSource = new CancellationTokenSource(); _msgQueue = ConnectionFactory.CreateLogicService(); this._ws = new WebSocketServer(); if (_ws.Setup(this.port)) { _ws.Start(); } _ws.NewSessionConnected += OnClientConnected; _ws.NewMessageReceived += OnMessageReceived; _ws.NewDataReceived += OnDataReceivedAsync; _ws.SessionClosed += OnClientClosed; // _timerMsgQueue = new Timer(new TimerCallback(GetMsg), this, 0, 800); }
public AccountController() { _sign = "123456789"; _account = ConnectionFactory.CreateAccountService(); }
protected BaseSocketServer() { LogicServer = new TNullLogicServer(); }
public void SetLogicServer(ILogicServer _logic_server) { logic_server = _logic_server; logic_server.Init(); }