Esempio n. 1
0
 public BayeuxClient(
     WebSocketTransportOptions options,
     IEnumerable <TimeSpan> reconnectDelays = null,
     TaskScheduler eventTaskScheduler       = null)
 {
     this.transport          = options.Build(PublishEventsAsync);
     this.eventTaskScheduler = ChooseEventTaskScheduler(eventTaskScheduler);
     this.connectLoop        = new ConnectLoop("websocket", reconnectDelays, this);
 }
 public void BeginConnectionLoop()
 {
     if (ConnectLoop.Running)
     {
         return;
     }
     Console.WriteLine("Starting Discord connection loop.");
     ConnectLoop.Start();
 }
Esempio n. 3
0
 /// <param name="eventTaskScheduler">
 /// <para>
 /// TaskScheduler for invoking events. Usually, you will be good by providing null. If you decide to
 /// your own TaskScheduler, please make sure that it guarantees ordered execution of events.
 /// </para>
 /// <para>
 /// If null is provided, SynchronizationContext.Current will be used. This means that WPF and
 /// Windows Forms applications will run events appropriately. If SynchronizationContext.Current
 /// is null, then a new TaskScheduler with ordered execution will be created.
 /// </para>
 /// </param>
 /// <param name="reconnectDelays">
 /// When a request results in network errors, reconnection trials will be delayed based on the
 /// values passed here. The last element of the collection will be re-used indefinitely.
 /// </param>
 public BayeuxClient(
     HttpLongPollingTransportOptions options,
     IEnumerable <TimeSpan> reconnectDelays = null,
     TaskScheduler eventTaskScheduler       = null)
 {
     this.transport          = options.Build(PublishEventsAsync);
     this.eventTaskScheduler = ChooseEventTaskScheduler(eventTaskScheduler);
     this.connectLoop        = new ConnectLoop("long-polling", reconnectDelays, this);
 }
 public void EndConnectionLoop()
 {
     if (!ConnectLoop.Running)
     {
         return;
     }
     Console.WriteLine("Ending Discord connection loop.");
     ConnectLoop.Stop();
     Console.WriteLine("Discord connection loop ended.");
 }