diff --git a/src/net45/Extensions/WampSharp.Vtortola/VtortolaAuthenticatedWebSocketTransport.cs b/src/net45/Extensions/WampSharp.Vtortola/VtortolaAuthenticatedWebSocketTransport.cs index 22af4656e..2da694577 100644 --- a/src/net45/Extensions/WampSharp.Vtortola/VtortolaAuthenticatedWebSocketTransport.cs +++ b/src/net45/Extensions/WampSharp.Vtortola/VtortolaAuthenticatedWebSocketTransport.cs @@ -1,5 +1,6 @@ using System.Net; using System.Security.Cryptography.X509Certificates; +using vtortola.WebSockets; using WampSharp.V2.Authentication; namespace WampSharp.Vtortola @@ -7,11 +8,14 @@ namespace WampSharp.Vtortola public class VtortolaAuthenticatedWebSocketTransport : VtortolaWebSocketTransport { public VtortolaAuthenticatedWebSocketTransport - (IPEndPoint endpoint, - bool perMessageDeflate, - ICookieAuthenticatorFactory authenticatorFactory, - X509Certificate2 certificate = null) - : base(endpoint, perMessageDeflate, authenticatorFactory, certificate) + (IPEndPoint endpoint, bool perMessageDeflate, ICookieAuthenticatorFactory authenticatorFactory, WebSocketListenerOptions options) + : this(endpoint, perMessageDeflate, authenticatorFactory, null, options) + { + } + + public VtortolaAuthenticatedWebSocketTransport + (IPEndPoint endpoint, bool perMessageDeflate, ICookieAuthenticatorFactory authenticatorFactory, X509Certificate2 certificate = null, WebSocketListenerOptions options = null) + : base(endpoint, perMessageDeflate, authenticatorFactory, certificate, options) { } } diff --git a/src/net45/Extensions/WampSharp.Vtortola/VtortolaWebSocketTransport.cs b/src/net45/Extensions/WampSharp.Vtortola/VtortolaWebSocketTransport.cs index bc3a2ef6e..43acb10ae 100644 --- a/src/net45/Extensions/WampSharp.Vtortola/VtortolaWebSocketTransport.cs +++ b/src/net45/Extensions/WampSharp.Vtortola/VtortolaWebSocketTransport.cs @@ -23,6 +23,7 @@ public class VtortolaWebSocketTransport : WebSocketTransport private WebSocketListener mListener; private readonly bool mPerMessageDeflate; private readonly X509Certificate2 mCertificate; + private readonly WebSocketListenerOptions mOptions; /// /// Creates a new instance of @@ -31,8 +32,20 @@ public class VtortolaWebSocketTransport : WebSocketTransport /// /// A value indicating whether to support permessage-deflate /// compression extension or not. - public VtortolaWebSocketTransport(IPEndPoint endpoint, bool perMessageDeflate, X509Certificate2 certificate = null) - : this(endpoint, perMessageDeflate, null, certificate) + public VtortolaWebSocketTransport(IPEndPoint endpoint, bool perMessageDeflate, WebSocketListenerOptions options) + : this(endpoint, perMessageDeflate, null, options) + { + } + + /// + /// Creates a new instance of + /// given the endpoint to run at. + /// + /// + /// A value indicating whether to support permessage-deflate + /// compression extension or not. + public VtortolaWebSocketTransport(IPEndPoint endpoint, bool perMessageDeflate, X509Certificate2 certificate = null, WebSocketListenerOptions options = null) + : this(endpoint, perMessageDeflate, null, certificate, options) { } @@ -45,13 +58,15 @@ public VtortolaWebSocketTransport(IPEndPoint endpoint, bool perMessageDeflate, X /// compression extension or not. /// /// + /// protected VtortolaWebSocketTransport - (IPEndPoint endpoint, bool perMessageDeflate, ICookieAuthenticatorFactory authenticatorFactory = null, X509Certificate2 certificate = null) + (IPEndPoint endpoint, bool perMessageDeflate, ICookieAuthenticatorFactory authenticatorFactory = null, X509Certificate2 certificate = null, WebSocketListenerOptions options = null) : base(authenticatorFactory) { mEndpoint = endpoint; mPerMessageDeflate = perMessageDeflate; mCertificate = certificate; + mOptions = options; } public override void Dispose() @@ -64,10 +79,11 @@ public override void Open() { string[] protocols = SubProtocols; - WebSocketListener listener = new WebSocketListener(mEndpoint, new WebSocketListenerOptions() - { - SubProtocols = protocols - }); + WebSocketListenerOptions options = mOptions ?? new WebSocketListenerOptions(); + + options.SubProtocols = protocols; + + WebSocketListener listener = new WebSocketListener(mEndpoint, options); WebSocketFactoryRfc6455 factory = new WebSocketFactoryRfc6455(listener);