void onShutdown(ShutdownCode code, byte[] data) { var cback = Handler; if (cback != null) { try { cback.OnShutdown(this, code, data); } catch (Exception err) { Helper.RaiseUnexpected(err); } } }
void IWebSocketHandler.OnShutdown(WebSocket sender, ShutdownCode code, byte[] data) { // ignore ? }
void onShutdown( ShutdownCode code, byte[] data ) { var cback = Handler; if (cback != null) try { cback.OnShutdown( this, code, data ); } catch (Exception err) { Helper.RaiseUnexpected( err ); } }
public void SendClose( ShutdownCode? code = null, byte[] data = null ) { Helper.CheckArg( data == null || data.Length < 124, "Shutdown.data.Length must be less than 124" ); Helper.CheckArg( code.HasValue || data == null, "If data is not null than ShutdownCode must be set" ); if (code.HasValue) { var bcode = BitConverter.GetBytes( IPAddress.HostToNetworkOrder( ( short )code.Value ) ); if (data != null) { var buf = new byte[ 2 + data.Length ]; Array.Copy( bcode, buf, 2 ); Array.Copy( data, 0, buf, 2, data.Length ); data = buf; } else data = bcode; } send( Opcode.Close, data, true ); }