示例#1
0
        public WebSocket(string uri, string subProtocol = "", string cookies = "", List<KeyValuePair<string, string>> customHeaderItems = null, string userAgent = "", string origin = "", WebSocketVersion version = WebSocketVersion.None)
        {
            List<KeyValuePair<string, string>> cookieList = null;

            if (!string.IsNullOrEmpty(cookies))
            {
                cookieList = new List<KeyValuePair<string, string>>();

                string[] pairs = cookies.Split(';');

                int pos;
                string key, value;

                foreach (var p in pairs)
                {
                    pos = p.IndexOf('=');
                    if (pos > 0)
                    {
                        key = p.Substring(0, pos).Trim();
                        pos += 1;
                        if (pos < p.Length)
                            value = p.Substring(pos).Trim();
                        else
                            value = string.Empty;

                        cookieList.Add(new KeyValuePair<string, string>(key, Uri.UnescapeDataString(value)));
                    }
                }
            }

            Initialize(uri, subProtocol, cookieList, customHeaderItems, userAgent, origin, version);
        }
 public WebSocketClient(string uri,
                        string subProtocol,
                        WebSocketVersion version) : base(uri,
                                                         subProtocol,
                                                         version)
 {
 }
 protected WebSocketClientTest(WebSocketVersion version, string security, string certificateFile, string password)
 {
     m_Version         = version;
     m_Security        = security;
     m_CertificateFile = certificateFile;
     m_Password        = password;
 }
        // Token: 0x060005EF RID: 1519 RVA: 0x00019CA4 File Offset: 0x00017EA4
        public ProtocolProcessorBase(WebSocketVersion version, ICloseStatusCode closeStatusCode)
        {
            this.CloseStatusCode = closeStatusCode;
            this.Version         = version;
            int num = (int)version;

            this.VersionTag = num.ToString();
        }
示例#5
0
 protected DraftHybi10Processor(
     WebSocketVersion version,
     ICloseStatusCode closeStatusCode,
     string originHeaderName)
     : base(version, closeStatusCode)
 {
     this.m_OriginHeaderName = originHeaderName;
 }
示例#6
0
 public WebSocket(
     string uri,
     string subProtocol,
     List <KeyValuePair <string, string> > cookies,
     WebSocketVersion version)
     : this(uri, subProtocol, cookies, new List <KeyValuePair <string, string> >(), (string)null, version)
 {
 }
示例#7
0
 public WebSocket(
     string uri,
     string subProtocol,
     List <KeyValuePair <string, string> > cookies,
     string userAgent,
     WebSocketVersion version)
     : this(uri, subProtocol, cookies, (List <KeyValuePair <string, string> >)null, userAgent, version)
 {
 }
示例#8
0
 public JsonWebSocket(
     string uri,
     string subProtocol,
     List <KeyValuePair <string, string> > cookies,
     WebSocketVersion version)
     : this(uri, subProtocol, cookies, (List <KeyValuePair <string, string> >)null, string.Empty, string.Empty,
            version)
 {
 }
示例#9
0
        public WebSocket(string uri, string subProtocol = "", List<KeyValuePair<string, string>> cookies = null, List<KeyValuePair<string, string>> customHeaderItems = null, string userAgent = "", string origin = "", WebSocketVersion version = WebSocketVersion.None, EndPoint httpConnectProxy = null, SslProtocols sslProtocols = SslProtocols.None)
        {
#if !NETFX_CORE
            if (sslProtocols != SslProtocols.None)
                m_SecureProtocols = sslProtocols;
#endif

            Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, httpConnectProxy);
        }
示例#10
0
文件: Client.cs 项目: zodiacg/IOTQQ
        public Client(string url, WebSocketVersion socketVersion)
        {
            this.uri = new Uri(url);

            this.socketVersion = socketVersion;

            this.registrationManager   = new RegistrationManager();
            this.outboundQueue         = new BlockingCollection <string>(new ConcurrentQueue <string>());
            this.dequeuOutBoundMsgTask = Task.Factory.StartNew(() => dequeuOutboundMessages(), TaskCreationOptions.LongRunning);
        }
示例#11
0
 public WebSocket(
     string uri,
     string subProtocol,
     List <KeyValuePair <string, string> > cookies,
     List <KeyValuePair <string, string> > customHeaderItems,
     string userAgent,
     WebSocketVersion version)
     : this(uri, subProtocol, cookies, customHeaderItems, userAgent, string.Empty, version)
 {
 }
示例#12
0
        // Token: 0x0600052A RID: 1322 RVA: 0x00005336 File Offset: 0x00003536
        private static IProtocolProcessor GetProtocolProcessor(WebSocketVersion version)
        {
            IProtocolProcessor processorByVersion = WebSocket.m_ProtocolProcessorFactory.GetProcessorByVersion(version);

            if (processorByVersion == null)
            {
                throw new ArgumentException("Invalid websocket version");
            }
            return(processorByVersion);
        }
示例#13
0
        public Client(string url, WebSocketVersion socketVersion)
        {
            this.uri = new Uri(url);

            this.socketVersion = socketVersion;

            this.registrationManager = new RegistrationManager();
            this.outboundQueue = new BlockingCollection<string>(new ConcurrentQueue<string>());
            this.dequeuOutBoundMsgTask = Task.Factory.StartNew(() => dequeuOutboundMessages(), TaskCreationOptions.LongRunning);
        }
示例#14
0
        public void Setup(string url, string protocol, WebSocketVersion version)
        {
            this.url        = url;
            this.protocol   = protocol;
            this.version    = WebSocketVersion.Rfc6455;
            websocketClient = new WebSocket(this.url, this.protocol, this.version);

            //  websocketClient.Error += new EventHandler<SuperSocket.ClientEngine.ErrorEventArgs>(websocketClient_Error);
            //  websocketClient.Opened += new EventHandler(websocketClient_Opened); //play short tone on connection
            websocketClient.MessageReceived += new EventHandler <MessageReceivedEventArgs>(websocketClient_MessageReceived);
        }
示例#15
0
        public WebsocketClient(string url, string protocol, string userName, string userPassword, EndPoint httpProxy = null)
        {
            this.url = url;
            this.protocol = protocol;
            this.version = WebSocketVersion.Rfc6455;
            this.httpProxy = httpProxy;
            // http auth
            this.authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(userName + ":" + userPassword));

            init();
        }
示例#16
0
 public WebSocket(
     string uri,
     string subProtocol,
     List <KeyValuePair <string, string> > cookies,
     List <KeyValuePair <string, string> > customHeaderItems,
     string userAgent,
     string origin,
     WebSocketVersion version)
     : this(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, (EndPoint)null)
 {
 }
示例#17
0
 public void Init()
 {
     this.url                         = "ws://mylive.in.th:9004/home/websocket/";
     this.protocol                    = "";
     this.version                     = WebSocketVersion.Rfc6455;
     websocketClient                  = new WebSocket(this.url, this.protocol, this.version);
     websocketClient.Error           += new EventHandler <SuperSocket.ClientEngine.ErrorEventArgs>(websocketClient_Error);
     websocketClient.Opened          += new EventHandler(websocketClient_Opened);
     websocketClient.MessageReceived += new EventHandler <MessageReceivedEventArgs>(websocketClient_MessageReceived);
     Aston.Log("WebSocket initiated.");
 }
示例#18
0
        public void Setup(string url, string protocol, WebSocketVersion version)
        {
            this.url = url;
            this.protocol = protocol;
            this.version = WebSocketVersion.Rfc6455;

            websocketClient = new WebSocket(this.url, this.protocol, this.version);

            websocketClient.Error               += new EventHandler<SuperSocket.ClientEngine.ErrorEventArgs>(websocketClient_Error);
            websocketClient.Opened              += new EventHandler(websocketClient_Opened);
            websocketClient.MessageReceived     += new EventHandler<MessageReceivedEventArgs>(websocketClient_MessageReceived);
        }
示例#19
0
 public WebSocket(
     string uri,
     string subProtocol,
     List <KeyValuePair <string, string> > cookies,
     List <KeyValuePair <string, string> > customHeaderItems,
     string userAgent,
     string origin,
     WebSocketVersion version,
     EndPoint httpConnectProxy)
 {
     this.Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, httpConnectProxy);
 }
示例#20
0
        public void Setup()
        {
            msgsList      = new List <Message>();
            this.url      = "ws://" + Properties.Settings.Default.Host.ToString() + ":8081";
            this.protocol = "basic";
            this.version  = WebSocketVersion.Rfc6455;

            websocketClient = new WebSocket(this.url, this.protocol, this.version);

            websocketClient.Error           += new EventHandler <ErrorEventArgs>(WebsocketClient_Error);
            websocketClient.Opened          += new EventHandler(WebsocketClient_Opened);
            websocketClient.MessageReceived += new EventHandler <MessageReceivedEventArgs>(WebsocketClient_MessageReceived);
        }
示例#21
0
 public JsonWebSocket(
     string uri,
     string subProtocol,
     List <KeyValuePair <string, string> > cookies,
     List <KeyValuePair <string, string> > customHeaderItems,
     string userAgent,
     string origin,
     WebSocketVersion version)
 {
     this.m_WebSocket = new WebSocket(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version);
     this.m_WebSocket.EnableAutoSendPing = true;
     this.SubscribeEvents();
 }
 public WebSocketClient(string uri,
                        string subProtocol = "",
                        List <KeyValuePair <string, string> > cookies           = null,
                        List <KeyValuePair <string, string> > customHeaderItems = null,
                        string userAgent         = "",
                        string origin            = "",
                        WebSocketVersion version = WebSocketVersion.None) : base(uri,
                                                                                 subProtocol,
                                                                                 cookies,
                                                                                 customHeaderItems,
                                                                                 userAgent,
                                                                                 origin,
                                                                                 version)
 {
 }
示例#23
0
        public MyClient(string uri, string protocol)
        {
            this.url      = uri;
            this.protocol = protocol;
            this.version  = WebSocketVersion.Rfc6455;

            this.Active = false;
            //this.timer1 = new Timer(new TimerCallback(TickTimer1),null,1000,3000);
            webSocket = new WebSocket(this.url, this.protocol, this.version);
            webSocket.AutoSendPingInterval = 2000;

            webSocket.Closed          += WebSocket_Closed;
            webSocket.DataReceived    += WebSocket_DataReceived;
            webSocket.Error           += new EventHandler <SuperSocket.ClientEngine.ErrorEventArgs>(WebSocket_Error);
            webSocket.Opened          += WebSocket_Opened;
            webSocket.MessageReceived += WebSocket_MessageReceived;
        }
示例#24
0
        protected WebSocket4Net.WebSocket CreateClient(WebSocketVersion version, bool autoConnect)
        {
            var webSocketClient = new WebSocket4Net.WebSocket(string.Format("ws://127.0.0.1:{0}/websocket", AppServer.Config.Port), "basic", version);
            webSocketClient.Opened += new EventHandler(webSocketClient_Opened);
            webSocketClient.Closed += new EventHandler(webSocketClient_Closed);
            webSocketClient.DataReceived += new EventHandler<DataReceivedEventArgs>(webSocketClient_DataReceived);
            webSocketClient.MessageReceived += new EventHandler<MessageReceivedEventArgs>(webSocketClient_MessageReceived);

            if (autoConnect)
            {
                webSocketClient.Open();

                if (!OpenedEvent.WaitOne(1000))
                    Assert.Fail("Failed to open");
            }
            
            return webSocketClient;
        }
示例#25
0
        protected WebSocket4Net.WebSocket CreateClient(WebSocketVersion version, bool autoConnect)
        {
            var webSocketClient = new WebSocket4Net.WebSocket(string.Format("ws://127.0.0.1:{0}/websocket", AppServer.Config.Port), "basic", version);

            webSocketClient.Opened          += new EventHandler(webSocketClient_Opened);
            webSocketClient.Closed          += new EventHandler(webSocketClient_Closed);
            webSocketClient.DataReceived    += new EventHandler <DataReceivedEventArgs>(webSocketClient_DataReceived);
            webSocketClient.MessageReceived += new EventHandler <MessageReceivedEventArgs>(webSocketClient_MessageReceived);

            if (autoConnect)
            {
                webSocketClient.Open();

                if (!OpenedEvent.WaitOne(1000))
                {
                    Assert.Fail("Failed to open");
                }
            }

            return(webSocketClient);
        }
示例#26
0
        private void Initialize(string uri, string subProtocol, List <KeyValuePair <string, string> > cookies, List <KeyValuePair <string, string> > customHeaderItems, string userAgent, string origin, WebSocketVersion version, EndPoint httpConnectProxy, int receiveBufferSize)
        {
            if (version == WebSocketVersion.None)
            {
                NotSpecifiedVersion = true;
                version             = WebSocketVersion.Rfc6455;
            }

            Version           = version;
            ProtocolProcessor = GetProtocolProcessor(version);

            Cookies = cookies;

            Origin = origin;

            if (!string.IsNullOrEmpty(userAgent))
            {
                if (customHeaderItems == null)
                {
                    customHeaderItems = new List <KeyValuePair <string, string> >();
                }

                customHeaderItems.Add(new KeyValuePair <string, string>(UserAgentKey, userAgent));
            }

            if (customHeaderItems != null && customHeaderItems.Count > 0)
            {
                CustomHeaderItems = customHeaderItems;
            }

            var handshakeCmd = new Command.Handshake();

            m_CommandDict.Add(handshakeCmd.Name, handshakeCmd);
            var textCmd = new Command.Text();

            m_CommandDict.Add(textCmd.Name, textCmd);
            var dataCmd = new Command.Binary();

            m_CommandDict.Add(dataCmd.Name, dataCmd);
            var closeCmd = new Command.Close();

            m_CommandDict.Add(closeCmd.Name, closeCmd);
            var pingCmd = new Command.Ping();

            m_CommandDict.Add(pingCmd.Name, pingCmd);
            var pongCmd = new Command.Pong();

            m_CommandDict.Add(pongCmd.Name, pongCmd);
            var badRequestCmd = new Command.BadRequest();

            m_CommandDict.Add(badRequestCmd.Name, badRequestCmd);

            m_StateCode = WebSocketStateConst.None;

            SubProtocol = subProtocol;

            Items = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);

            m_HttpConnectProxy = httpConnectProxy;

            TcpClientSession client;

            if (uri.StartsWith(m_UriPrefix, StringComparison.OrdinalIgnoreCase))
            {
                client = CreateClient(uri, receiveBufferSize);
            }
            else if (uri.StartsWith(m_SecureUriPrefix, StringComparison.OrdinalIgnoreCase))
            {
#if !NETFX_CORE
                client = CreateSecureClient(uri, receiveBufferSize);
#else
                throw new NotSupportedException("WebSocket4Net still has not supported secure websocket for UWP yet.");
#endif
            }
            else
            {
                throw new ArgumentException("Invalid uri", "uri");
            }

            client.Connected    += new EventHandler(client_Connected);
            client.Closed       += new EventHandler(client_Closed);
            client.Error        += new EventHandler <ErrorEventArgs>(client_Error);
            client.DataReceived += new EventHandler <DataEventArgs>(client_DataReceived);

            Client = client;

            //Ping auto sending is enabled by default
            EnableAutoSendPing = true;
        }
示例#27
0
 public WebSocket(string uri, string subProtocol = "", List<KeyValuePair<string, string>> cookies = null, List<KeyValuePair<string, string>> customHeaderItems = null, string userAgent = "", string origin = "", WebSocketVersion version = WebSocketVersion.None, EndPoint httpConnectProxy = null, SslProtocols sslProtocols = SslProtocols.Default)
 {
     Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, httpConnectProxy, sslProtocols);
 }
 protected WebSocketClientTest(WebSocketVersion version)
     : this(version, string.Empty, string.Empty, string.Empty)
 {
     
 }
示例#29
0
 public IPhotonPeer ConnectWebSocket(string ipAddress, ushort port, WebSocketVersion version, string url, string subProtocols, object userData)
 {
     throw new NotImplementedException();
 }
示例#30
0
		public Client(string url, WebSocketVersion socketVersion)
			: this(url, WebSocketVersion.Rfc6455, null)
		{
		}
 public WebSocket(string uri, string subProtocol, WebSocketVersion version)
     : this(uri, subProtocol, null, version)
 {
 }
示例#32
0
        public WebSocket(string uri, WebSocketVersion version)
            : this(uri, string.Empty, null, version)
        {

        }
示例#33
0
 public WebSocketRequestBuilder Version8()
 {
     this.version = WebSocketVersion.V08;
     return(this);
 }
示例#34
0
 public WebSocket(string uri, string subProtocol = "", List<KeyValuePair<string, string>> cookies = null, List<KeyValuePair<string, string>> customHeaderItems = null, string userAgent = "", string origin = "", WebSocketVersion version = WebSocketVersion.None, SslProtocols sslProtocols = SslProtocols.Default)
     : this(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, null, sslProtocols)
 {
 }
示例#35
0
 protected WebSocket CreateClient(WebSocketVersion version)
 {
     return CreateClient(version, true);
 }
 public WebSocketClientTest(WebSocketVersion version)
 {
     m_Version = version;
 }
 public IPhotonPeer ConnectWebSocket(string ipAddress, ushort port, WebSocketVersion version, string url, string subProtocols, object userData)
 {
     throw new NotImplementedException();
 }
示例#38
0
        protected DraftHybi10Processor(WebSocketVersion version, ICloseStatusCode closeStatusCode)
            : base(version, closeStatusCode)
        {

        }
示例#39
0
        private static IProtocolProcessor GetProtocolProcessor(WebSocketVersion version)
        {
            var processor = m_ProtocolProcessorFactory.GetProcessorByVersion(version);

            if (processor == null)
                throw new ArgumentException("Invalid websocket version");

            return processor;
        }
示例#40
0
        public WebSocket(string uri, string subProtocol, WebSocketVersion version)
            : this(uri, subProtocol, null, version)
        {

        }
 public WebSocket(string uri, string subProtocol, WebSocketVersion version)
     : this(uri, subProtocol, EmptyCookies, null, string.Empty, string.Empty, version)
 {
 }
示例#42
0
        public WebSocket(string uri, string subProtocol, List<KeyValuePair<string, string>> cookies, string userAgent, WebSocketVersion version)
            : this(uri, subProtocol, cookies, null, userAgent, version)
        {

        }
示例#43
0
 public WebSocketRequestBuilder Version00()
 {
     this.version = null;
     return(this);
 }
示例#44
0
        public WebSocket(string uri, string subProtocol, List<KeyValuePair<string, string>> cookies, List<KeyValuePair<string, string>> customHeaderItems, string userAgent, WebSocketVersion version)
            : this(uri, subProtocol, cookies, customHeaderItems, userAgent, string.Empty, version)
        {

        }
 public WebSocket(string uri, WebSocketVersion version)
     : this(uri, string.Empty, null, version)
 {
 }
示例#46
0
 public WebSocket(string uri, string subProtocol, List<KeyValuePair<string, string>> cookies, List<KeyValuePair<string, string>> customHeaderItems, string userAgent, string origin, WebSocketVersion version, EndPoint httpConnectProxy)
 {
     Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, httpConnectProxy, SslProtocols.Default);
 }
 public WebSocket(string uri, string subProtocol, List <KeyValuePair <string, string> > cookies, List <KeyValuePair <string, string> > customHeaderItems, string userAgent, string origin, WebSocketVersion version)
 {
     Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version);
 }
示例#48
0
 public WebSocket(string uri, string subProtocol, List<KeyValuePair<string, string>> cookies = null, List<KeyValuePair<string, string>> customHeaderItems = null, string userAgent = "", string origin = "", WebSocketVersion version = WebSocketVersion.None)
 {
     Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version);
 }
 protected WebSocketClientTest(WebSocketVersion version, string security, string certificateFile, string password)
 {
     m_Version = version;
     m_Security = security;
     m_CertificateFile = certificateFile;
     m_Password = password;
 }
 public WebSocket(string uri, string subProtocol = "", List<KeyValuePair<string, string>> cookies = null, List<KeyValuePair<string, string>> customHeaderItems = null, string userAgent = "", string origin = "", WebSocketVersion version = WebSocketVersion.None, EndPoint httpConnectProxy = null, int receiveBufferSize = 0)
 {
     Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, httpConnectProxy, receiveBufferSize);
 }
 public WebSocketClientTest(WebSocketVersion version)
 {
     m_Version = version;
 }
 public IProtocolProcessor GetProcessorByVersion(WebSocketVersion version)
 {
     return m_OrderedProcessors.FirstOrDefault(p => p.Version == version);
 }
示例#53
0
 public WebSocket(string uri, string subProtocol, List<KeyValuePair<string, string>> cookies, List<KeyValuePair<string, string>> customHeaderItems, string userAgent, string origin, WebSocketVersion version, EndPoint httpConnectProxy, System.Security.Authentication.SslProtocols sslProtocols)
 {
     m_SecureProtocols = sslProtocols;
     Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, httpConnectProxy);
 }
示例#54
0
 public WebSocket(string uri, string subProtocol, WebSocketVersion version)
     : this(uri, subProtocol, EmptyCookies, null, string.Empty, string.Empty, version)
 {
 }
示例#55
0
 public Client(string url, WebSocketVersion socketVersion)
     : this(url, WebSocketVersion.Rfc6455, null)
 {
 }
示例#56
0
 public WebSocket(string uri, string subProtocol = "", List <KeyValuePair <string, string> > cookies = null, List <KeyValuePair <string, string> > customHeaderItems = null, string userAgent = "", string origin = "", WebSocketVersion version = WebSocketVersion.None, EndPoint httpConnectProxy = null, SslProtocols sslProtocols = SslProtocols.None, int receiveBufferSize = 0)
 {
     if (sslProtocols != 0)
     {
         m_SecureProtocols = sslProtocols;
     }
     Initialize(uri, subProtocol, cookies, customHeaderItems, userAgent, origin, version, httpConnectProxy, receiveBufferSize);
 }
示例#57
0
        private void Initialize(string uri, string subProtocol, List<KeyValuePair<string, string>> cookies, List<KeyValuePair<string, string>> customHeaderItems, string userAgent, string origin, WebSocketVersion version)
        {
            if (version == WebSocketVersion.None)
            {
                NotSpecifiedVersion = true;
                version = WebSocketVersion.Rfc6455;
            }

            Version = version;
            ProtocolProcessor = GetProtocolProcessor(version);

            Cookies = cookies;

            Origin = origin;

            if (!string.IsNullOrEmpty(userAgent))
            {
                if (customHeaderItems == null)
                    customHeaderItems = new List<KeyValuePair<string, string>>();

                customHeaderItems.Add(new KeyValuePair<string, string>(UserAgentKey, userAgent));
            }

            if (customHeaderItems != null && customHeaderItems.Count > 0)
                CustomHeaderItems = customHeaderItems;

            var handshakeCmd = new Command.Handshake();
            m_CommandDict.Add(handshakeCmd.Name, handshakeCmd);
            var textCmd = new Command.Text();
            m_CommandDict.Add(textCmd.Name, textCmd);
            var dataCmd = new Command.Binary();
            m_CommandDict.Add(dataCmd.Name, dataCmd);
            var closeCmd = new Command.Close();
            m_CommandDict.Add(closeCmd.Name, closeCmd);
            var pingCmd = new Command.Ping();
            m_CommandDict.Add(pingCmd.Name, pingCmd);
            var pongCmd = new Command.Pong();
            m_CommandDict.Add(pongCmd.Name, pongCmd);
            var badRequestCmd = new Command.BadRequest();
            m_CommandDict.Add(badRequestCmd.Name, badRequestCmd);

            m_StateCode = WebSocketStateConst.None;

            SubProtocol = subProtocol;

            Items = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);

            TcpClientSession client;

            if (uri.StartsWith(m_UriPrefix, StringComparison.OrdinalIgnoreCase))
            {
                client = CreateClient(uri);
            }
            else if (uri.StartsWith(m_SecureUriPrefix, StringComparison.OrdinalIgnoreCase))
            {
                client = CreateSecureClient(uri);
            }
            else
            {
                throw new ArgumentException("Invalid uri", "uri");
            }

            client.Connected += new EventHandler(client_Connected);
            client.Closed += new EventHandler(client_Closed);
            client.Error += new EventHandler<ErrorEventArgs>(client_Error);
            client.DataReceived += new EventHandler<DataEventArgs>(client_DataReceived);

            Client = client;

            //Ping auto sending is enabled by default
            EnableAutoSendPing = true;
        }
 protected DraftHybi10Processor(WebSocketVersion version, ICloseStatusCode closeStatusCode, string originHeaderName)
     : base(version, closeStatusCode)
 {
     this.m_OriginHeaderName = originHeaderName;
 }
 public ProtocolProcessorBase(WebSocketVersion version, ICloseStatusCode closeStatusCode)
 {
     CloseStatusCode = closeStatusCode;
     Version = version;
     VersionTag = ((int)version).ToString();
 }
示例#60
0
 public WebSocket(string uri, string subProtocol, WebSocketVersion version, SslProtocols sslProtocols = SslProtocols.Default)
     : this(uri, subProtocol, EmptyCookies, null, string.Empty, string.Empty, version, sslProtocols)
 {
 }