示例#1
0
 /// <summary>
 /// Creates a new instance of <see cref="FleckWebSocketTransport"/>
 /// given the server address to run at.
 /// </summary>
 /// <param name="location">The given server address.</param>
 /// <param name="cookieAuthenticatorFactory"></param>
 /// <param name="certificate">The <see cref="X509Certificate2"/> certificate to use for secured websockets.</param>
 /// <param name="supportDualStack">IPv4/IPv6 dual stack support</param>
 protected FleckWebSocketTransport(string location,
                                   ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
                                   X509Certificate2 certificate = null,
                                   bool supportDualStack        = true)
     : this(location : location, cookieAuthenticatorFactory : null, certificate : certificate, supportDualStack : supportDualStack, getEnabledSslProtocols : null)
 {
 }
示例#2
0
 public FleckAuthenticatedWebSocketTransport
     (string location,
     ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
     X509Certificate2 certificate = null)
     : base(location, cookieAuthenticatorFactory, certificate)
 {
 }
示例#3
0
 public FleckAuthenticatedWebSocketTransport
     (string location,
     ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
     X509Certificate2 certificate = null)
     : this(location : location, cookieAuthenticatorFactory : cookieAuthenticatorFactory, certificate : certificate, getEnabledSslProtocols : null)
 {
 }
 public TextWebSocketWrapperConnection(IWebSocketWrapper webSocket, IWampTextBinding <TMessage> binding,
                                       ICookieProvider cookieProvider,
                                       ICookieAuthenticatorFactory cookieAuthenticatorFactory, int?maxFrameSize) :
     base(webSocket, binding, cookieProvider, cookieAuthenticatorFactory, maxFrameSize)
 {
     mBinding = binding;
 }
示例#5
0
 public VtortolaWampBinaryConnection(WebSocket connection,
                                     IWampBinaryBinding <TMessage> binding,
                                     ICookieAuthenticatorFactory cookieAuthenticatorFactory) :
     base(connection, cookieAuthenticatorFactory)
 {
     mBinding = binding;
 }
 public FleckWampTextConnection(IWebSocketConnection webSocketConnection,
                                IWampTextBinding <TMessage> binding,
                                ICookieAuthenticatorFactory cookieAuthenticatorFactory = null)
     : base(webSocketConnection, cookieAuthenticatorFactory)
 {
     mBinding = binding;
     webSocketConnection.OnMessage = OnConnectionMessage;
 }
示例#7
0
 public AspNetCoreWebSocketTransport
     (IApplicationBuilder app,
     ICookieAuthenticatorFactory authenticatorFactory = null) :
     base(authenticatorFactory)
 {
     mHandler = this.EmptyHandler;
     app.Use(HttpHandler);
 }
示例#8
0
 public FleckAuthenticatedWebSocketTransport
     (string location,
     ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
     X509Certificate2 certificate = null,
     Func <SslProtocols> getEnabledSslProtocols = null)
     : base(location, cookieAuthenticatorFactory, certificate, getEnabledSslProtocols)
 {
 }
 public VtortolaAuthenticatedWebSocketTransport
     (IPEndPoint endpoint,
     bool perMessageDeflate,
     ICookieAuthenticatorFactory authenticatorFactory,
     X509Certificate2 certificate = null)
     : base(endpoint, perMessageDeflate, authenticatorFactory, certificate)
 {
 }
 /// <summary>
 /// Creates a new instance of <see cref="VtortolaWebSocketTransport"/>
 /// given the endpoint to run at.
 /// </summary>
 /// <param name="endpoint"></param>
 /// <param name="perMessageDeflate">A value indicating whether to support permessage-deflate
 ///     compression extension or not.</param>
 /// <param name="authenticatorFactory"></param>
 /// <param name="certificate"></param>
 protected VtortolaWebSocketTransport
     (IPEndPoint endpoint, bool perMessageDeflate, ICookieAuthenticatorFactory authenticatorFactory = null, X509Certificate2 certificate = null)
     : base(authenticatorFactory)
 {
     mEndpoint          = endpoint;
     mPerMessageDeflate = perMessageDeflate;
     mCertificate       = certificate;
 }
 public VtortolaWampTextConnection(WebSocket connection,
                                   CancellationToken cancellationToken,
                                   IWampTextBinding <TMessage> binding,
                                   ICookieAuthenticatorFactory cookieAuthenticatorFactory) :
     base(connection, cancellationToken, cookieAuthenticatorFactory)
 {
     mBinding = binding;
 }
示例#12
0
 protected VtortolaWampConnection(WebSocket websocket,
                                  ICookieAuthenticatorFactory cookieAuthenticatorFactory)
     : base(new CookieCollectionCookieProvider(websocket.HttpRequest.Cookies),
            cookieAuthenticatorFactory)
 {
     mWebsocket        = websocket;
     mTransportDetails = new VtortolaTransportDetails(mWebsocket);
 }
示例#13
0
 /// <exclude />
 public HttpListenerWebSocketTransport
     (string url,
     Action <HttpListenerContext> onUnknownRequest    = null,
     ICookieAuthenticatorFactory authenticatorFactory = null)
     : base(authenticatorFactory)
 {
     mUrl = url;
     mOnUnknownRequest = onUnknownRequest ?? CancelRequest;
 }
 public OwinWebSocketTransport
     (IAppBuilder app,
     int?maxFrameSize,
     ICookieAuthenticatorFactory authenticatorFactory = null) :
     base(authenticatorFactory)
 {
     mHandler = this.EmptyHandler;
     app.Use(HttpHandler);
     mMaxFrameSize = maxFrameSize;
 }
        /// <summary>
        /// Creates a new instance of <see cref="FleckWebSocketTransport"/>
        /// given the server address to run at.
        /// </summary>
        /// <param name="location">The given server address.</param>
        /// <param name="cookieAuthenticatorFactory"></param>
        /// <param name="certificate"></param>
        protected FleckWebSocketTransport(string location,
                                          ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
                                          X509Certificate2 certificate = null)
            : base(cookieAuthenticatorFactory)
        {
            mServer             = new WebSocketServer(location);
            mServer.Certificate = certificate;

            RouteLogs();
        }
示例#16
0
 public WebSocketWrapperConnection(IWebSocketWrapper webSocket, IWampMessageParser <TMessage, TRaw> parser,
                                   ICookieProvider cookieProvider,
                                   ICookieAuthenticatorFactory cookieAuthenticatorFactory, int?maxFrameSize) :
     base(cookieProvider, cookieAuthenticatorFactory)
 {
     mWebSocket               = webSocket;
     mParser                  = parser;
     mMaxFrameSize            = maxFrameSize;
     mCancellationTokenSource = new CancellationTokenSource();
     mCancellationToken       = mCancellationTokenSource.Token;
 }
示例#17
0
 /// <summary>
 /// Initializes a new instance of <see cref="DefaultWampHost"/> listening at
 /// the given location with the given bindings and the given
 /// <see cref="IWampRealmContainer"/>.
 /// </summary>
 /// <param name="location">The given location.</param>
 /// <param name="sessionAuthenticationFactory">The <see cref="IWampSessionAuthenticatorFactory"/>
 /// used to accept pending clients.</param>
 /// <param name="cookieAuthenticatorFactory">The given <see cref="ICookieAuthenticatorFactory"/> used to authenticate
 /// users given their cookies.</param>
 /// <param name="certificate">The <see cref="X509Certificate2"/> certificate to use for secured websockets.</param>
 public DefaultWampAuthenticationHost
     (string location,
     IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
     ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
     X509Certificate2 certificate = null)
     : this(location : location,
            sessionAuthenticationFactory : sessionAuthenticationFactory,
            bindings : null,
            cookieAuthenticatorFactory : cookieAuthenticatorFactory,
            certificate : certificate)
 {
 }
        public AsyncWebSocketWampConnection
            (ICookieProvider cookieProvider,
            ICookieAuthenticatorFactory cookieAuthenticatorFactory = null)
        {
            if (cookieAuthenticatorFactory != null)
            {
                IWampSessionAuthenticator authenticator =
                    cookieAuthenticatorFactory.CreateAuthenticator(cookieProvider);

                mAuthenticator = authenticator;
            }
        }
示例#19
0
 /// <summary>
 /// Initializes a new instance of <see cref="DefaultWampHost"/> listening at
 /// the given location with the given bindings and the given
 /// <see cref="IWampRealmContainer"/>.
 /// </summary>
 /// <param name="location">The given location.</param>
 /// <param name="sessionAuthenticationFactory"></param>
 /// <param name="bindings">The given bindings.</param>
 /// <param name="cookieAuthenticatorFactory"></param>
 /// <param name="certificate"></param>
 public DefaultWampAuthenticationHost
     (string location,
     IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
     IEnumerable <IWampBinding> bindings = null,
     ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
     X509Certificate2 certificate = null)
     : this(location : location,
            sessionAuthenticationFactory : sessionAuthenticationFactory,
            realmContainer : null,
            uriValidator : null,
            bindings : bindings,
            cookieAuthenticatorFactory : cookieAuthenticatorFactory, certificate : certificate)
 {
 }
示例#20
0
        /// <summary>
        /// Initializes a new instance of <see cref="DefaultWampHost"/> listening at
        /// the given location with the given bindings and the given
        /// <see cref="IWampRealmContainer"/>.
        /// </summary>
        /// <param name="location">The given location.</param>
        /// <param name="sessionAuthenticationFactory">The <see cref="IWampSessionAuthenticatorFactory"/>
        /// used to accept pending clients.</param>
        /// <param name="realmContainer">The <see cref="IWampRealmContainer"/> associated with this
        /// host.</param>
        /// <param name="uriValidator">The <see cref="IWampUriValidator"/> used to validate uris.</param>
        /// <param name="bindings">The given bindings.</param>
        /// <param name="cookieAuthenticatorFactory">The given <see cref="ICookieAuthenticatorFactory"/> used to authenticate
        /// users given their cookies.</param>
        /// <param name="certificate">The <see cref="X509Certificate2"/> certificate to use for secured websockets.</param>
        public DefaultWampAuthenticationHost(string location,
                                             IWampSessionAuthenticatorFactory sessionAuthenticationFactory,
                                             IWampRealmContainer realmContainer  = null,
                                             IWampUriValidator uriValidator      = null,
                                             IEnumerable <IWampBinding> bindings = null,
                                             ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
                                             X509Certificate2 certificate = null)
            : base(sessionAuthenticationFactory, realmContainer, uriValidator)
        {
            bindings = bindings ?? new IWampBinding[] { new JTokenJsonBinding(), new JTokenMsgpackBinding() };

            this.RegisterTransport(
                new FleckAuthenticatedWebSocketTransport(location, cookieAuthenticatorFactory, certificate),
                bindings.ToArray());
        }
        /// <summary>
        /// Creates a new instance of <see cref="FleckWebSocketTransport"/>
        /// given the server address to run at.
        /// </summary>
        /// <param name="location">The given server address.</param>
        /// <param name="cookieAuthenticatorFactory"></param>
        /// <param name="certificate">The <see cref="X509Certificate2"/> certificate to use for secured websockets.</param>
        /// <param name="getEnabledSslProtocols"> If non-null, used to set Fleck's EnabledSslProtocols. </param>
        protected FleckWebSocketTransport(string location,
                                          ICookieAuthenticatorFactory cookieAuthenticatorFactory = null,
                                          X509Certificate2 certificate = null,
                                          Func <SslProtocols> getEnabledSslProtocols = null)
            : base(cookieAuthenticatorFactory)
        {
            mServer             = new WebSocketServer(location);
            mServer.Certificate = certificate;

            if (getEnabledSslProtocols != null)
            {
                mServer.EnabledSslProtocols = getEnabledSslProtocols();
            }

            RouteLogs();
        }
示例#22
0
        public FleckWampConnection(IWebSocketConnection webSocketConnection,
                                   ICookieAuthenticatorFactory cookieAuthenticatorFactory,
                                   TimeSpan?autoSendPingInterval = null) :
            base(new FleckCookieProvider(webSocketConnection.ConnectionInfo),
                 cookieAuthenticatorFactory)
        {
            mWebSocketConnection = webSocketConnection;

            mPingPongHandler =
                new PingPongHandler(mLogger,
                                    new FleckPinger(webSocketConnection),
                                    autoSendPingInterval ?? TimeSpan.FromSeconds(45));

            mWebSocketConnection.OnOpen  = OnConnectionOpen;
            mWebSocketConnection.OnError = OnConnectionError;
            mWebSocketConnection.OnClose = OnConnectionClose;
            mTransportDetails            = new FleckTransportDetails(mWebSocketConnection.ConnectionInfo);
        }
示例#23
0
 public WebSocketTransport(ICookieAuthenticatorFactory authenticatorFactory)
 {
     AuthenticatorFactory = authenticatorFactory;
 }
 /// <exclude />
 public AspNetWebSocketTransport(string url,
                                 ICookieAuthenticatorFactory authenticatorFactory = null)
     : base(authenticatorFactory)
 {
     mUrl = url;
 }
 public BinaryWebSocketConnection(WebSocket webSocket, IWampBinaryBinding <TMessage> binding, ICookieProvider cookieProvider, ICookieAuthenticatorFactory cookieAuthenticatorFactory) :
     base(webSocket, binding, cookieProvider, cookieAuthenticatorFactory)
 {
     mBinding = binding;
 }
示例#26
0
 public WebSocketWrapperConnection(IWebSocketWrapper webSocket, IWampStreamingMessageParser <TMessage> parser, ICookieProvider cookieProvider, ICookieAuthenticatorFactory cookieAuthenticatorFactory) :
     base(cookieProvider, cookieAuthenticatorFactory)
 {
     mWebSocket = webSocket;
     mParser    = parser;
     mCancellationTokenSource = new CancellationTokenSource();
 }
示例#27
0
 public VtortolaAuthenticatedWebSocketTransport
     (IPEndPoint endpoint, bool perMessageDeflate, ICookieAuthenticatorFactory authenticatorFactory, WebSocketListenerOptions options)
     : this(endpoint, perMessageDeflate, authenticatorFactory, null, options)
 {
 }
 public BinaryWebSocketConnection(WebSocket webSocket, IWampBinaryBinding <TMessage> binding,
                                  ICookieProvider cookieProvider,
                                  ICookieAuthenticatorFactory cookieAuthenticatorFactory, int?maxFrameSize) :
     base(new WebSocketWrapper(webSocket), binding, cookieProvider, cookieAuthenticatorFactory, maxFrameSize)
 {
 }
示例#29
0
 public TextWebSocketConnection(WebSocket webSocket, IWampTextBinding <TMessage> binding, ICookieProvider cookieProvider, ICookieAuthenticatorFactory cookieAuthenticatorFactory) : base(new WebSocketWrapper(webSocket), binding, cookieProvider, cookieAuthenticatorFactory)
 {
 }