@@ -23,6 +23,7 @@ public class VtortolaWebSocketTransport : WebSocketTransport<WebSocket>
2323 private WebSocketListener mListener ;
2424 private readonly bool mPerMessageDeflate ;
2525 private readonly X509Certificate2 mCertificate ;
26+ private readonly WebSocketListenerOptions mOptions ;
2627
2728 /// <summary>
2829 /// Creates a new instance of <see cref="VtortolaWebSocketTransport"/>
@@ -31,8 +32,20 @@ public class VtortolaWebSocketTransport : WebSocketTransport<WebSocket>
3132 /// <param name="endpoint"></param>
3233 /// <param name="perMessageDeflate">A value indicating whether to support permessage-deflate
3334 /// compression extension or not.</param>
34- public VtortolaWebSocketTransport ( IPEndPoint endpoint , bool perMessageDeflate , X509Certificate2 certificate = null )
35- : this ( endpoint , perMessageDeflate , null , certificate )
35+ public VtortolaWebSocketTransport ( IPEndPoint endpoint , bool perMessageDeflate , WebSocketListenerOptions options )
36+ : this ( endpoint , perMessageDeflate , null , options )
37+ {
38+ }
39+
40+ /// <summary>
41+ /// Creates a new instance of <see cref="VtortolaWebSocketTransport"/>
42+ /// given the endpoint to run at.
43+ /// </summary>
44+ /// <param name="endpoint"></param>
45+ /// <param name="perMessageDeflate">A value indicating whether to support permessage-deflate
46+ /// compression extension or not.</param>
47+ public VtortolaWebSocketTransport ( IPEndPoint endpoint , bool perMessageDeflate , X509Certificate2 certificate = null , WebSocketListenerOptions options = null )
48+ : this ( endpoint , perMessageDeflate , null , certificate , options )
3649 {
3750 }
3851
@@ -45,13 +58,15 @@ public VtortolaWebSocketTransport(IPEndPoint endpoint, bool perMessageDeflate, X
4558 /// compression extension or not.</param>
4659 /// <param name="authenticatorFactory"></param>
4760 /// <param name="certificate"></param>
61+ /// <param name="options"></param>
4862 protected VtortolaWebSocketTransport
49- ( IPEndPoint endpoint , bool perMessageDeflate , ICookieAuthenticatorFactory authenticatorFactory = null , X509Certificate2 certificate = null )
63+ ( IPEndPoint endpoint , bool perMessageDeflate , ICookieAuthenticatorFactory authenticatorFactory = null , X509Certificate2 certificate = null , WebSocketListenerOptions options = null )
5064 : base ( authenticatorFactory )
5165 {
5266 mEndpoint = endpoint ;
5367 mPerMessageDeflate = perMessageDeflate ;
5468 mCertificate = certificate ;
69+ mOptions = options ;
5570 }
5671
5772 public override void Dispose ( )
@@ -64,10 +79,11 @@ public override void Open()
6479 {
6580 string [ ] protocols = SubProtocols ;
6681
67- WebSocketListener listener = new WebSocketListener ( mEndpoint , new WebSocketListenerOptions ( )
68- {
69- SubProtocols = protocols
70- } ) ;
82+ WebSocketListenerOptions options = mOptions ?? new WebSocketListenerOptions ( ) ;
83+
84+ options . SubProtocols = protocols ;
85+
86+ WebSocketListener listener = new WebSocketListener ( mEndpoint , options ) ;
7187
7288 WebSocketFactoryRfc6455 factory = new WebSocketFactoryRfc6455 ( listener ) ;
7389
0 commit comments