private void _pusher_Error(object sender, PusherException error) { try { _pusher.Disconnect(); Thread.Sleep(1000); _pusher.Connect(); } catch { } }
static void Main(string[] args) { // Get the user's name Console.WriteLine("What is your name?"); _name = Console.ReadLine(); InitPusher(); // Read input in loop string line; do { line = Console.ReadLine(); if (line == "quit") { break; } else { _chatChannel.Trigger("client-my-event", new { message = line, name = _name }); } } while (line != null); _pusher.Disconnect(); }
public override Task UnsubscribeAllAsync() { if (_pusherClient != null) { _pusherClient.UnbindAll(); _pusherClient.Disconnect(); } return(Task.CompletedTask); }
public static void disconnect() { if (pusher != null) { foreach (Channel c in JobsServer.channels) { c.Unsubscribe(); } pusher.Disconnect(); pusher.ConnectionStateChanged -= onStateChanged_handler; pusher.Error -= onError_handler; pusher = null; } }
private async Task StopPusher() { if (_pusher == null) { return; } await Task.Factory.StartNew(() => { _loggingService.WriteInformation($"Stopping Pusher"); _pusher.Disconnect(); _pusher = null; _loggingService.WriteInformation($"Pusher is stopped"); }); }
public BitstampService() { _pusher = new Pusher("de504dc5763aeef9ff52"); _pusher.ConnectionStateChanged += _pusher_ConnectionStateChanged; _pusher.Error += _pusher_Error; // Setup private channel _chatChannel = _pusher.Subscribe("live_orders"); _chatChannel.Subscribed += _chatChannel_Subscribed; // Inline binding! _chatChannel.BindAll((string ch, dynamic data) => { try { Console.WriteLine(data["price"]); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine(data); }); _pusher.Connect(); string line; do { line = Console.ReadLine(); if (line == "quit") { break; } //else // _chatChannel.Trigger("client-my-event", new { message = line, name = _name }); } while (line != null); _pusher.Disconnect(); }
/// <summary> /// Cleans up platform objects /// </summary> public void CleanUp() { _client.Disconnect(); }
private void buttonDisconnect_Click(object sender, EventArgs e) { _pusher.Disconnect(); buttonConnect.Enabled = true; buttonDisconnect.Enabled = false; }
public override void Logout() { TickerTimer.Stop(); _pusher.Disconnect(); }
public void Disconnect() { _pusher.Disconnect(); }
public void Dispose() { _client?.Disconnect(); }