public override Dynamic.Net.Base.INetCommand Execute(Dynamic.Net.Base.INetSession session)
        {
            if (InnerData != null && InnerData.Length > 0)
            {
                Content = session.Encoding.GetString(InnerData);
            }

            WebSocketSessionBase ws = session as WebSocketSessionBase;

            if (ws == null)
            {
                return(null);
            }

            MessageReceivedEventArgs args = new MessageReceivedEventArgs()
            {
                Content     = this.Content,
                ContentType = MessageContentType.Text,
                Data        = InnerData,
                Session     = ws,
                IsAync      = false
            };

            ws.OnMessageReceived(args);

            INetCommand responseCommand = null;

            if (!args.IsAync && !String.IsNullOrEmpty(args.ResponseContent))
            {
                responseCommand = WebSocketCommandFactory.CreateCommand(args.ResponseContent);
            }

            return(responseCommand);
        }
        public override Dynamic.Net.Base.INetCommand Execute(Dynamic.Net.Base.INetSession session)
        {
            WebSocketSessionBase ws = session as WebSocketSessionBase;

            if (ws == null)
            {
                return(null);
            }

            MessageReceivedEventArgs args = new MessageReceivedEventArgs()
            {
                ContentType = MessageContentType.Binary,
                Data        = InnerData,
                Session     = session as WebSocketSessionBase,
                IsAync      = false
            };

            ws.OnMessageReceived(args);

            INetCommand responseCommand = null;

            if (!args.IsAync && args.ResponseData != null && args.ResponseData.Length > 0)
            {
                responseCommand = WebSocketCommandFactory.CreateCommand(args.ResponseData);
            }

            return(responseCommand);
        }
        public override void SessionCreated(Dynamic.Net.Base.INetSession session)
        {
            base.SessionCreated(session);
            WebSocketSessionBase ws = session as WebSocketSessionBase;

            if (ws != null)
            {
                ws.MessageReceived    += new EventHandler <MessageReceivedEventArgs>(ws_MessageReceived);
                ws.SwitchingProtocol  += new EventHandler <SwitchingProtocolEventArgs>(ws_SwitchingProtocol);
                ws.HandshakeCompleted += new EventHandler(ws_HandshakeCompleted);
            }
        }
Example #4
0
        public override Dynamic.Net.Base.INetCommand Execute(Dynamic.Net.Base.INetSession session)
        {
            WebSocketSession ws = session as WebSocketSession;

            if (ws == null)
            {
                return(null);
            }

            PongCommand pongCommand = new PongCommand();

            pongCommand.InnerData = this.InnerData;


            return(pongCommand);
        }
Example #5
0
 public override Dynamic.Net.Base.INetCommand GetCommand(Dynamic.Net.Base.INetSession session)
 {
     throw new NotImplementedException();
 }
Example #6
0
 protected override void WriteFrameEndBytes(Dynamic.Net.Base.INetCommand command, Dynamic.Net.Base.INetSession session)
 {
     return;
 }
Example #7
0
 protected override void WriteCommandParameterSplitBytes(Dynamic.Net.Base.INetCommand command, Dynamic.Net.Base.INetSession session)
 {
     return;
 }
Example #8
0
 public override Dynamic.Net.Base.INetCommand Execute(Dynamic.Net.Base.INetSession session)
 {
     return(null);
 }