internal override void OnClientConnected(SocketConnectedEventArgs e)
        {
            if (!ConnectionQueue.ContainsKey(e.UniqueId))
            {
                ConnectionQueue.Add(e.UniqueId, e.Address);
            }

            base.OnClientConnected(e);
        }
        private void OnClientOpen(object sender, EventArgs e)
        {
            var ea = new SocketConnectedEventArgs
            {
                Address  = Localhost,
                UniqueId = Localhost
            };

            OnClientConnected(ea);
            OnTrace(UILogLevel.Info, "Connected to remote server.");
        }
        protected override void OnOpen()
        {
            var remoteHost = Context.UserEndPoint.ToString();
            var e          = new SocketConnectedEventArgs
            {
                Address  = remoteHost,
                UniqueId = ID
            };

            _socket.OnClientConnected(e);
            _socket.OnTrace(UILogLevel.Info, $"Client {remoteHost} connected.");

            if (_socket.ConnectionQueue.Count > 1)
            {
                _socket.OnTrace(UILogLevel.Warn, "Disconnecting client. Multiple clients cannot be connected.");
                Context.WebSocket.Close();
            }
        }
Beispiel #4
0
 internal virtual void OnClientConnected(SocketConnectedEventArgs e)
 {
     ClientConnected?.Invoke(this, e);
 }