Exemplo n.º 1
0
        public WebSocketClient(Uri uri, WebSocketClientConfiguration configuration = null, Action<string> log = null)
        {
            if (uri == null)
                throw new ArgumentNullException("uri");

            if (!Consts.WebSocketSchemes.Contains(uri.Scheme.ToLowerInvariant()))
                throw new NotSupportedException(
                    string.Format("Not support the specified scheme [{0}].", uri.Scheme));

            _uri = uri;
            _remoteEndPoint = ResolveRemoteEndPoint(_uri);
            _configuration = configuration != null ? configuration : new WebSocketClientConfiguration();
            _log = log != null ? log : (s) => { };
            _sslEnabled = uri.Scheme.ToLowerInvariant() == "wss";

            Initialize();
        }
Exemplo n.º 2
0
        public WebSocketClient(Uri uri, WebSocketClientConfiguration configuration = null, Action <string> log = null)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            if (!Consts.WebSocketSchemes.Contains(uri.Scheme.ToLowerInvariant()))
            {
                throw new NotSupportedException(
                          string.Format("Not support the specified scheme [{0}].", uri.Scheme));
            }

            _uri            = uri;
            _remoteEndPoint = ResolveRemoteEndPoint(_uri);
            _configuration  = configuration != null ? configuration : new WebSocketClientConfiguration();
            _log            = log != null ? log : (s) => { };
            _sslEnabled     = uri.Scheme.ToLowerInvariant() == "wss";

            Initialize();
        }