コード例 #1
0
        private async Task OnMessage(string message, IWebSocketConnection socket)
        {
            var logger = this.loggerFactory.CreateLogger("Socket Received");

            try
            {
                var context = ConnectionContextCreator.Create(socket, connectionLifetimeManager, simpleProtocol, userIdProvider);

                if (this.simpleProtocol.TryParseMessage(message, out Message messageData))
                {
                    await Invoke(messageData, message, context);
                }
            }
            catch (Exception ex)
            {
                logger.LogError(ex, ex.Message);
            }
        }
コード例 #2
0
        private async Task OnOpen(IWebSocketConnection socket)
        {
            var context = ConnectionContextCreator.Create(socket, connectionLifetimeManager, simpleProtocol, userIdProvider);

            await this.connectionLifetimeManager.OnConnectedAsync(context);
        }