Пример #1
0
        /// <summary>
        /// Disconnects the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="packet">The packet.</param>
        public async Task Disconnect(IChannelHandlerContext context, DisconnectPacket packet)
        {
            var deviceId = await _channelService.GetDeviceId(context.Channel);

            var message = TransportMessage.CreateInvokeMessage(new RemoteInvokeMessage
            {
                ServiceId = "Disconnect", Parameters = new Dictionary <string, object> {
                    { "packet", packet }
                }
            });

            WirteDiagnosticBefore(message, context.Channel.RemoteAddress.ToString(), deviceId, packet.PacketType);
            await _channelService.Close(deviceId, true);

            WirteDiagnosticAfter(message);
        }
Пример #2
0
 public async Task Disconnect(IChannelHandlerContext context, DisconnectPacket packet)
 {
     await _channelService.Close(await _channelService.GetDeviceId(context.Channel), true);
 }