diff --git a/PusherClient/Connection.cs b/PusherClient/Connection.cs index 4ea5480..ef14c38 100644 --- a/PusherClient/Connection.cs +++ b/PusherClient/Connection.cs @@ -50,11 +50,7 @@ public async Task ConnectAsync() ChangeState(ConnectionState.Connecting); - _websocket = new WebSocket(_url) - { - EnableAutoSendPing = true, - AutoSendPingInterval = 1 - }; + CreateNewWebSocket(); await Task.Run(() => { @@ -467,16 +463,31 @@ private void DisposeWebsocket() ChangeState(ConnectionState.Disconnected); } - private void RecreateWebSocket() + private void CreateNewWebSocket() { - DisposeWebsocket(); - _websocket = new WebSocket(_url) + _websocket = new WebSocket(_url, + "", //string subProtocol = "", + null, //List> cookies = null, + null, //List> customHeaderItems = null, + "", //string userAgent = "", + "", //string origin = "", + WebSocketVersion.None, // WebSocketVersion version = WebSocketVersion.None, + null, // EndPoint httpConnectProxy = null, + _pusher.PusherOptions.EnabledSslProtocols, + 0) // int receiveBufferSize = 0) { EnableAutoSendPing = true, AutoSendPingInterval = 1 }; } + + private void RecreateWebSocket() + { + DisposeWebsocket(); + CreateNewWebSocket(); + } + private void ParseError(JToken jToken) { JToken message = jToken.SelectToken("message"); diff --git a/PusherClient/PusherOptions.cs b/PusherClient/PusherOptions.cs index 6e593da..bd06ac2 100644 --- a/PusherClient/PusherOptions.cs +++ b/PusherClient/PusherOptions.cs @@ -1,4 +1,5 @@ using System; +using System.Security.Authentication; namespace PusherClient { @@ -104,6 +105,12 @@ public string Host /// public TimeSpan ClientTimeout { get; set; } = TimeSpan.FromSeconds(30); + + /// + /// Gets or sets the ssl security protocol to communicate. The default value is SslProtocols.None. + /// + public SslProtocols EnabledSslProtocols { get; set; } = SslProtocols.None; + /// /// Gets or sets the to use for tracing debug messages. ///