public Task AcceptWebSocketAsync(WebSocket webSocket)
        {
            if (webSocket == null)
            {
                throw new ArgumentNullException(nameof(webSocket));
            }

            var channel       = new MqttWebSocketServerChannel(webSocket);
            var clientAdapter = _mqttCommunicationAdapterFactory.CreateServerCommunicationAdapter(channel);

            var eventArgs = new MqttServerAdapterClientAcceptedEventArgs(clientAdapter);

            ClientAccepted?.Invoke(this, eventArgs);
            return(eventArgs.SessionTask);
        }
Пример #2
0
        public Task AcceptWebSocketAsync(WebSocket webSocket)
        {
            if (webSocket == null)
            {
                throw new ArgumentNullException(nameof(webSocket));
            }

            var channel       = new MqttWebSocketServerChannel(webSocket);
            var clientAdapter = new MqttChannelAdapter(channel, new MqttPacketSerializer(), new MqttNetLogger());

            var eventArgs = new MqttServerAdapterClientAcceptedEventArgs(clientAdapter);

            ClientAccepted?.Invoke(this, eventArgs);
            return(eventArgs.SessionTask);
        }