private void On_Opened() { Console.WriteLine("---OPENED"); //socket.Emit("auth", this.credentials, ack: (string name, object error, object data) => //Console.WriteLine(this.credentials.ToString()); OnClientReady?.Invoke(); return; socket.Emit("auth", this.credentials, ack: (string name, object err, object data) => { if (!((bool)err) && (data != null)) { this.socket.SetAuthToken((string)data); this.socket.Connect(); OnClientReady?.Invoke(); this.socket.Subscribe("ORDER-PLNX--BTC--ETH"); /*var scChannel = this.socket.subscribe("ORDER-PLNX--BTC--ETH"); * scChannel.watch(function(data) { * console.log(data); * });*/ } else { Console.WriteLine(err); } }); /*{ * OnClientReady?.Invoke(); * });*/ }
public IEnumerable <string> GetChannels() { if (_scClient == null || _scClient.SocketState != WebSocketState.Open) { return(null); } var results = new List <string>(); var ackReceived = false; _scClient.Emit("channels", "", (name, error, data) => { var res = (List <dynamic>)data; foreach (Dictionary <string, object> r in res[0]) { try { results.Add(r["channel"].ToString()); } catch { // ignore stupid items } } ackReceived = true; }); var st = DateTime.UtcNow; do { // just wait a few for results if needed if (ackReceived) { break; } } while (st.AddSeconds(20000) > DateTime.UtcNow); // remove depreciated if (results.Contains("TICKER")) { results.Remove("TICKER"); } if (results.Contains("CHATMSG")) { results.Remove("CHATMSG"); } if (results.Contains("NOTIFICATION")) { results.Remove("NOTIFICATION"); } return(results); }
private void On_Opened() { socket.Emit("auth", credentials, ack: (string name, object error, object data) => { isAuthorized = true; OnClientReady?.Invoke(); }); }
void Socket_OnOpened() { Console.WriteLine("WebsocketCoinigy::Socket_OnOpened()"); // We first need to authenticate with the socket. We will start receiving information // from the socket after the authentication succeeds. To authenticate with the // webservice, we need to send the "auth" command along with our credentials. // The "auth" command can only be called once the socket has opened. /*socket.Emit("auth", this.credentials, ack: (string name, object error, object data) => * { * // We can now start listening to trade information * Console.WriteLine("WebsocketCoinigy->emitted auth credentials"); * OnClientReady?.Invoke(); * });*/ Console.WriteLine("WebsocketCoinigy->emitting auth credentials..."); socket.Emit("auth", this.credentials); }