ChatterBox.Server.UnregisteredConnection.WaitForRegistration C# (CSharp) Method

WaitForRegistration() public method

public WaitForRegistration ( ) : void
return void
        public void WaitForRegistration()
        {
            Task.Run(async () =>
            {
                var reader = new StreamReader(TcpClient.GetStream());
                var clientChannelProxy = new ChannelInvoker(this);
                var message = await reader.ReadLineAsync();
                if (!clientChannelProxy.ProcessRequest(message).Invoked)
                {
                    OnInvalidRequest(InvalidMessage.For(message));
                }
            });
        }

Usage Example

Example #1
0
 private void HandleNewConnection(TcpClient tcpClient)
 {
     Task.Run(() =>
     {
         var connection = new UnregisteredConnection(tcpClient);
         Logger.Info($"{connection} connected.");
         connection.OnRegister += UnregisteredConnection_OnRegister;
         UnregisteredConnections.GetOrAdd(connection.Id, connection);
         connection.WaitForRegistration();
     });
 }
All Usage Examples Of ChatterBox.Server.UnregisteredConnection::WaitForRegistration