Пример #1
0
 private void _pusher_Error(object sender, PusherException error)
 {
     try
     {
         _pusher.Disconnect();
         Thread.Sleep(1000);
         _pusher.Connect();
     }
     catch
     { }
 }
Пример #2
0
        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();
        }
Пример #3
0
 public override Task UnsubscribeAllAsync()
 {
     if (_pusherClient != null)
     {
         _pusherClient.UnbindAll();
         _pusherClient.Disconnect();
     }
     return(Task.CompletedTask);
 }
Пример #4
0
 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;
     }
 }
Пример #5
0
        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");
            });
        }
Пример #6
0
        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();
        }
Пример #7
0
 /// <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;
 }
Пример #9
0
 public override void Logout()
 {
     TickerTimer.Stop();
     _pusher.Disconnect();
 }
Пример #10
0
 public void Disconnect()
 {
     _pusher.Disconnect();
 }
 public void Dispose()
 {
     _client?.Disconnect();
 }