GetChannel() public method

public GetChannel ( ) : IChannel
return IChannel
コード例 #1
0
ファイル: Client.cs プロジェクト: shlee322/Netronics
 public Client(HttpContact contact, ISocketIO socketIO)
 {
     _socketIO = socketIO;
     _channel = contact.GetChannel();
     _endPoint = contact.GetRequest().GetPath();
     _endPoint = _endPoint.Substring(0, _endPoint.Length - 3);
 }
コード例 #2
0
ファイル: XhrChannel.cs プロジェクト: shlee322/Netronics
        public void Send(HttpContact contact)
        {
            string o;
            if(_sendQueue.TryDequeue(out o) && o != null)
            {
                contact.GetResponse().SetContent(o);
                contact.GetChannel().SendMessage(contact.GetResponse());
                return;
            }

            _liveContact = contact;
        }
コード例 #3
0
ファイル: SocketIO.cs プロジェクト: shlee322/Netronics
        public void XhrPolling(HttpContact contact, string[] args)
        {
            if (args.Length < 3)
                return;
            _clientLock.EnterReadLock();
            var client = GetClient(args[1]);
            _clientLock.ExitReadLock();
            if (client == null)
                return;

            if (contact.GetChannel().ToString().Substring(0, contact.GetChannel().ToString().IndexOf(":", StringComparison.Ordinal))
                != client.GetChannel().ToString().Substring(0, client.GetChannel().ToString().IndexOf(":", StringComparison.Ordinal)))
                return;

            if(!(client.GetChannel() is XhrChannel))
                client.Connected(new ConnectContext(new XhrChannel(contact.GetChannel().ToString().Substring(0, contact.GetChannel().ToString().IndexOf(":", StringComparison.Ordinal)))));

            var channel = client.GetChannel() as XhrChannel;
            contact.GetResponse().ContentType = "text/plain";
            if (contact.GetRequest().GetMethod() == "GET")
            {
                channel.Send(contact);
                contact.IsAutoSendResponse = false;
            }
            else
            {
                //POST일 경우 클라 -> 서버
                channel.Receive(contact.GetRequest().GetLowPostData());
                contact.GetResponse().SetContent("1");
            }
        }