@@ -23,6 +23,7 @@ public class VtortolaWebSocketTransport : WebSocketTransport<WebSocket>
23
23
private WebSocketListener mListener ;
24
24
private readonly bool mPerMessageDeflate ;
25
25
private readonly X509Certificate2 mCertificate ;
26
+ private readonly WebSocketListenerOptions mOptions ;
26
27
27
28
/// <summary>
28
29
/// Creates a new instance of <see cref="VtortolaWebSocketTransport"/>
@@ -31,8 +32,20 @@ public class VtortolaWebSocketTransport : WebSocketTransport<WebSocket>
31
32
/// <param name="endpoint"></param>
32
33
/// <param name="perMessageDeflate">A value indicating whether to support permessage-deflate
33
34
/// 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 )
36
49
{
37
50
}
38
51
@@ -45,13 +58,15 @@ public VtortolaWebSocketTransport(IPEndPoint endpoint, bool perMessageDeflate, X
45
58
/// compression extension or not.</param>
46
59
/// <param name="authenticatorFactory"></param>
47
60
/// <param name="certificate"></param>
61
+ /// <param name="options"></param>
48
62
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 )
50
64
: base ( authenticatorFactory )
51
65
{
52
66
mEndpoint = endpoint ;
53
67
mPerMessageDeflate = perMessageDeflate ;
54
68
mCertificate = certificate ;
69
+ mOptions = options ;
55
70
}
56
71
57
72
public override void Dispose ( )
@@ -64,10 +79,11 @@ public override void Open()
64
79
{
65
80
string [ ] protocols = SubProtocols ;
66
81
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 ) ;
71
87
72
88
WebSocketFactoryRfc6455 factory = new WebSocketFactoryRfc6455 ( listener ) ;
73
89
0 commit comments