@@ -343,7 +343,7 @@ public class EventSubWebsocketClient
343
343
/// <param name="serviceProvider">DI Container to resolve other dependencies dynamically</param>
344
344
/// <param name="websocketClient">Underlying Websocket client to connect to connect to EventSub Websocket service</param>
345
345
/// <exception cref="ArgumentNullException">Throws ArgumentNullException if a dependency is null</exception>
346
- public EventSubWebsocketClient ( ILogger < EventSubWebsocketClient > logger , IEnumerable < INotificationHandler > handlers , IServiceProvider serviceProvider , WebsocketClient websocketClient )
346
+ public EventSubWebsocketClient ( ILogger < EventSubWebsocketClient > logger , IEnumerable < INotificationHandler > handlers , IServiceProvider serviceProvider , WebsocketClient websocketClient )
347
347
{
348
348
_logger = logger ?? throw new ArgumentNullException ( nameof ( logger ) ) ;
349
349
_serviceProvider = serviceProvider ?? throw new ArgumentNullException ( nameof ( serviceProvider ) ) ;
@@ -362,7 +362,7 @@ public EventSubWebsocketClient ( ILogger<EventSubWebsocketClient> logger, IEnume
362
362
/// Instantiates an EventSubWebsocketClient used to subscribe to EventSub notifications via Websockets.
363
363
/// </summary>
364
364
/// <param name="loggerFactory">LoggerFactory used to construct Loggers for the EventSubWebsocketClient and underlying classes</param>
365
- public EventSubWebsocketClient ( ILoggerFactory loggerFactory = null )
365
+ public EventSubWebsocketClient ( ILoggerFactory loggerFactory = null )
366
366
{
367
367
_loggerFactory = loggerFactory ;
368
368
@@ -394,7 +394,7 @@ public EventSubWebsocketClient ( ILoggerFactory loggerFactory = null )
394
394
/// </summary>
395
395
/// <param name="url">Optional url param to be able to connect to reconnect urls provided by Twitch or test servers</param>
396
396
/// <returns>true: Connection successful false: Connection failed</returns>
397
- public async Task < bool > ConnectAsync ( Uri url = null )
397
+ public async Task < bool > ConnectAsync ( Uri url = null )
398
398
{
399
399
url = url ?? new Uri ( WEBSOCKET_URL ) ;
400
400
_lastReceived = DateTimeOffset . MinValue ;
@@ -417,7 +417,7 @@ public async Task<bool> ConnectAsync ( Uri url = null )
417
417
/// Disconnect from Twitch EventSub Websockets
418
418
/// </summary>
419
419
/// <returns>true: Disconnect successful false: Disconnect failed</returns>
420
- public async Task < bool > DisconnectAsync ( )
420
+ public async Task < bool > DisconnectAsync ( )
421
421
{
422
422
_cts ? . Cancel ( ) ;
423
423
return await _websocketClient . DisconnectAsync ( ) ;
@@ -427,7 +427,7 @@ public async Task<bool> DisconnectAsync ()
427
427
/// Reconnect to Twitch EventSub Websockets with a Twitch given Url
428
428
/// </summary>
429
429
/// <returns>true: Reconnect successful false: Reconnect failed</returns>
430
- public Task < bool > ReconnectAsync ( )
430
+ public Task < bool > ReconnectAsync ( )
431
431
{
432
432
return ReconnectAsync ( new Uri ( WEBSOCKET_URL ) ) ;
433
433
}
@@ -437,7 +437,7 @@ public Task<bool> ReconnectAsync ()
437
437
/// </summary>
438
438
/// <param name="url">New Websocket Url to connect to, to preserve current session and topics</param>
439
439
/// <returns>true: Reconnect successful false: Reconnect failed</returns>
440
- private async Task < bool > ReconnectAsync ( Uri url )
440
+ private async Task < bool > ReconnectAsync ( Uri url )
441
441
{
442
442
url = url ?? new Uri ( WEBSOCKET_URL ) ;
443
443
@@ -509,7 +509,7 @@ private async Task<bool> ReconnectAsync ( Uri url )
509
509
/// Setup handlers for all supported subscription types
510
510
/// </summary>
511
511
/// <param name="handlers">Enumerable of handlers that are responsible for acting on a specified subscription type</param>
512
- private void PrepareHandlers ( IEnumerable < INotificationHandler > handlers )
512
+ private void PrepareHandlers ( IEnumerable < INotificationHandler > handlers )
513
513
{
514
514
_handlers = _handlers ?? new Dictionary < string , Action < EventSubWebsocketClient , string , JsonSerializerOptions > > ( ) ;
515
515
@@ -529,7 +529,7 @@ private void PrepareHandlers ( IEnumerable<INotificationHandler> handlers )
529
529
/// <para>E.g. a Twitch specified 10 seconds minimum frequency would result in 12 seconds used by the client to honor network latencies and so on.</para>
530
530
/// </summary>
531
531
/// <returns>a Task that represents the background operation</returns>
532
- private async Task ConnectionCheckAsync ( )
532
+ private async Task ConnectionCheckAsync ( )
533
533
{
534
534
while ( _cts != null && _websocketClient . IsConnected && ! _cts . IsCancellationRequested )
535
535
{
@@ -551,7 +551,7 @@ private async Task ConnectionCheckAsync ()
551
551
/// </summary>
552
552
/// <param name="sender">Sender of the event. In this case <see cref="WebsocketClient"/></param>
553
553
/// <param name="e">EventArgs send with the event. <see cref="DataReceivedArgs"/></param>
554
- private async Task OnDataReceived ( object sender , DataReceivedArgs e )
554
+ private async Task OnDataReceived ( object sender , DataReceivedArgs e )
555
555
{
556
556
_lastReceived = DateTimeOffset . Now ;
557
557
@@ -596,7 +596,7 @@ private async Task OnDataReceived ( object sender, DataReceivedArgs e )
596
596
/// </summary>
597
597
/// <param name="sender">Sender of the event. In this case <see cref="WebsocketClient"/></param>
598
598
/// <param name="e">EventArgs send with the event. <see cref="ErrorOccuredArgs"/></param>
599
- private async Task OnErrorOccurred ( object sender , ErrorOccuredArgs e )
599
+ private async Task OnErrorOccurred ( object sender , ErrorOccuredArgs e )
600
600
{
601
601
await ErrorOccurred . InvokeAsync ( this , e ) ;
602
602
}
@@ -605,7 +605,7 @@ private async Task OnErrorOccurred ( object sender, ErrorOccuredArgs e )
605
605
/// Handles 'session_reconnect' notifications
606
606
/// </summary>
607
607
/// <param name="message">notification message received from Twitch EventSub</param>
608
- private void HandleReconnect ( string message )
608
+ private void HandleReconnect ( string message )
609
609
{
610
610
_logger ? . LogReconnectRequested ( SessionId ) ;
611
611
var data = JsonSerializer . Deserialize < EventSubWebsocketSessionInfoMessage > ( message , _jsonSerializerOptions ) ;
@@ -620,7 +620,7 @@ private void HandleReconnect ( string message )
620
620
/// Handles 'session_welcome' notifications
621
621
/// </summary>
622
622
/// <param name="message">notification message received from Twitch EventSub</param>
623
- private async ValueTask HandleWelcome ( string message )
623
+ private async ValueTask HandleWelcome ( string message )
624
624
{
625
625
var data = JsonSerializer . Deserialize < EventSubWebsocketSessionInfoMessage > ( message , _jsonSerializerOptions ) ;
626
626
@@ -644,7 +644,7 @@ private async ValueTask HandleWelcome ( string message )
644
644
/// Handles 'session_disconnect' notifications
645
645
/// </summary>
646
646
/// <param name="message">notification message received from Twitch EventSub</param>
647
- private async Task HandleDisconnect ( string message )
647
+ private async Task HandleDisconnect ( string message )
648
648
{
649
649
var data = JsonSerializer . Deserialize < EventSubWebsocketSessionInfoMessage > ( message ) ;
650
650
@@ -658,7 +658,7 @@ private async Task HandleDisconnect ( string message )
658
658
/// Handles 'session_keepalive' notifications
659
659
/// </summary>
660
660
/// <param name="message">notification message received from Twitch EventSub</param>
661
- private void HandleKeepAlive ( string message )
661
+ private void HandleKeepAlive ( string message )
662
662
{
663
663
_logger ? . LogMessage ( message ) ;
664
664
}
@@ -668,7 +668,7 @@ private void HandleKeepAlive ( string message )
668
668
/// </summary>
669
669
/// <param name="message">notification message received from Twitch EventSub</param>
670
670
/// <param name="subscriptionType">subscription type received from Twitch EventSub</param>
671
- private void HandleNotification ( string message , string subscriptionType )
671
+ private void HandleNotification ( string message , string subscriptionType )
672
672
{
673
673
if ( _handlers != null && _handlers . TryGetValue ( subscriptionType , out var handler ) )
674
674
handler ( this , message , _jsonSerializerOptions ) ;
@@ -680,7 +680,7 @@ private void HandleNotification ( string message, string subscriptionType )
680
680
/// Handles 'revocation' notifications
681
681
/// </summary>
682
682
/// <param name="message">notification message received from Twitch EventSub</param>
683
- private void HandleRevocation ( string message )
683
+ private void HandleRevocation ( string message )
684
684
{
685
685
if ( _handlers != null && _handlers . TryGetValue ( "revocation" , out var handler ) )
686
686
handler ( this , message , _jsonSerializerOptions ) ;
@@ -693,7 +693,7 @@ private void HandleRevocation ( string message )
693
693
/// </summary>
694
694
/// <param name="eventName">name of the event to raise</param>
695
695
/// <param name="args">args to pass with the event</param>
696
- internal async void RaiseEvent ( string eventName , object args = null )
696
+ internal async void RaiseEvent ( string eventName , object args = null )
697
697
{
698
698
var fInfo = GetType ( ) . GetField ( eventName , BindingFlags . Instance | BindingFlags . NonPublic ) ;
699
699
0 commit comments