public Client(string url, WebSocketVersion socketVersion) { this.uri = new Uri(url); this.socketVersion = socketVersion; this.registrationManager = new RegistrationManager(); this.outboundQueue = new BlockingCollection<string>(new ConcurrentQueue<string>()); this.dequeuOutBoundMsgTask = Task.Factory.StartNew(() => dequeuOutboundMessages(), TaskCreationOptions.LongRunning); }
private Timer socketHeartBeatTimer; // HeartBeat timer #endregion Fields #region Constructors // Constructors /* public Client(string url) : this(url, WebSocketVersion.Rfc6455) { } */ //public Client(string url, WebSocketVersion socketVersion) public Client(string url) { this.uri = new Uri(url); //this.socketVersion = socketVersion; this.registrationManager = new RegistrationManager(); //this.outboundQueue = (new ConcurrentQueue<string>()); this.outboundQueue = (new Queue<string>()); this.dequeuOutBoundMsgTask = new Thread(new ThreadStart(dequeuOutboundMessages)); //this.dequeuOutBoundMsgTask = Task.Factory.StartNew(() => dequeuOutboundMessages(), TaskCreationOptions.LongRunning); this.dequeuOutBoundMsgTask.Start(); }
/// <summary> /// Close SocketIO4Net.Client and clear all event registrations /// </summary> public void Close() { this.retryConnectionCount = 0; // reset for next connection cycle // stop the heartbeat time this.closeHeartBeatTimer(); // stop outbound messages this.closeOutboundQueue(); this.closeWebSocketClient(); if (this.registrationManager != null) { this.registrationManager.Dispose(); this.registrationManager = null; } }
/// <summary> /// Close SocketIO4Net.Client and clear all event registrations /// </summary> public void Close() { this.mwsState = WebSocketState.Closing; // stop the heartbeat time this.closeHeartBeatTimer(); // stop outbound messages this.closeOutboundQueue(); this.closeWebSocketClient(); if (this.registrationManager != null) { this.registrationManager.Dispose(); this.registrationManager = null; } }