/// <summary> /// It will initiate the closing of the connection to the server. /// </summary> public void Close(UInt16 code, string msg) { if (closed) { return; } Send(new WebSocketFrame(this.WebSocket, WebSocketFrameTypes.ConnectionClose, WebSocket.EncodeCloseData(code, msg))); }
/// <summary> /// It will initiate the closing of the connection to the server. /// </summary> public void Close(UInt16 code, string msg) { if (closed) { return; } HTTPManager.Logger.Verbose("WebSocketResponse", string.Format("Close({0}, \"{1}\")", code, msg), this.Context); WebSocketFrame frame; while (this.unsentFrames.TryDequeue(out frame)) { ; } //this.unsentFrames.Clear(); Interlocked.Exchange(ref this._bufferedAmount, 0); Send(new WebSocketFrame(this.WebSocket, WebSocketFrameTypes.ConnectionClose, WebSocket.EncodeCloseData(code, msg))); }
/// <summary> /// It will initiate the closing of the connection to the server. /// </summary> public void Close(UInt16 code, string msg) { if (closed) { return; } WebSocketFrame frame; while (this.unsentFrames.TryDequeue(out frame)) { ; } //this.unsentFrames.Clear(); Interlocked.Exchange(ref this._bufferedAmount, 0); Send(new WebSocketFrame(this.WebSocket, WebSocketFrameTypes.ConnectionClose, WebSocket.EncodeCloseData(code, msg))); }
/// <summary> /// It will initiate the closing of the connection to the server. /// </summary> public void Close(UInt16 code, string msg) { if (closed) { return; } lock (SendLock) this.unsentFrames.Clear(); Interlocked.Exchange(ref this._bufferedAmount, 0); Send(new WebSocketFrame(this.WebSocket, WebSocketFrameTypes.ConnectionClose, WebSocket.EncodeCloseData(code, msg))); }