public void Connect() { ws = new WebSocket(); ws.Handler = this; //ws.Open(wsurl); // Subscribe to channels //ws.Send("{'event':'ping'}"); //ws.SendUTF8("{'event':'addChannel','channel':'ok_btcusd_ticker'}"); //ws.SendAscii("{'event':'addChannel','channel':'ok_btcusd_trades'}"); //ws.SendAscii("{'event':'addChannel','channel':'ok_btcusd_depth'}"); }
void IWebSocketHandler.OnString(WebSocket sender, string data) { //handleString(data); }
void IWebSocketHandler.OnShutdown(WebSocket sender, ShutdownCode code, byte[] data) { // ignore ? }
void IWebSocketHandler.OnPong(WebSocket sender, byte[] data) { }
void IWebSocketHandler.OnError(WebSocket sender, string op, Exception err) { /*var cback = OnError; if (cback != null) try { cback(null, err.Message, op); } catch (Exception err2) { Helper.RaiseUnexpected(err2); }*/ }
void IWebSocketHandler.OnClosed(WebSocket sender) { if (_wasDisconnect) return; /* var cback = OnDisconnect; if (cback != null) try { cback(null); } catch (Exception err) { Helper.RaiseUnexpected(err); }*/ _wasDisconnect = true; }
void IWebSocketHandler.OnBinary(WebSocket sender, byte[] data) { }