@@ -231,7 +231,7 @@ public static IStreamChatLowLevelClient CreateDefaultClient(AuthCredentials auth
231231 {
232232 config = StreamClientConfig . Default ;
233233 }
234-
234+
235235 var logs = StreamDependenciesFactory . CreateLogger ( config . LogLevel . ToLogLevel ( ) ) ;
236236 var applicationInfo = StreamDependenciesFactory . CreateApplicationInfo ( ) ;
237237 var websocketClient
@@ -357,7 +357,7 @@ public void Connect()
357357
358358 _websocketClient . ConnectAsync ( connectionUri ) . LogIfFailed ( _logs ) ;
359359 }
360-
360+
361361 public void SeAuthorizationCredentials ( AuthCredentials authCredentials )
362362 {
363363 if ( authCredentials . IsAnyEmpty ( ) )
@@ -415,7 +415,8 @@ public void Update(float deltaTime)
415415 public void SetReconnectStrategySettings ( ReconnectStrategy reconnectStrategy , float ? exponentialMinInterval ,
416416 float ? exponentialMaxInterval , float ? constantInterval )
417417 {
418- _reconnectScheduler . SetReconnectStrategySettings ( reconnectStrategy , exponentialMinInterval , exponentialMaxInterval , constantInterval ) ;
418+ _reconnectScheduler . SetReconnectStrategySettings ( reconnectStrategy , exponentialMinInterval ,
419+ exponentialMaxInterval , constantInterval ) ;
419420 }
420421
421422 public async Task FetchAndProcessEventsSinceLastReceivedEvent ( IEnumerable < string > channelCids )
@@ -445,12 +446,12 @@ public async Task FetchAndProcessEventsSinceLastReceivedEvent(IEnumerable<string
445446 Watch = true ,
446447 } ) ;
447448
448- if ( response . Events . Count == 0 )
449+ if ( response . Events . Count == 0 )
449450 {
450451 return ;
451452 }
452453
453- foreach ( var e in response . Events )
454+ foreach ( var e in response . Events )
454455 {
455456 // StreamTodo: check if we can not serialized this again. Investigate adding a custom EventsJsonConverter that would populate the list as serialized strings
456457 var serializedMsg = _serializer . Serialize ( e ) ;
@@ -463,15 +464,15 @@ public async Task FetchAndProcessEventsSinceLastReceivedEvent(IEnumerable<string
463464 public void Dispose ( )
464465 {
465466 ConnectionState = ConnectionState . Closing ;
466-
467+
467468 _reconnectScheduler . Dispose ( ) ;
468469
469470 TryCancelWaitingForUserConnection ( ) ;
470471
471472 _websocketClient . ConnectionFailed -= OnWebsocketsConnectionFailed ;
472473 _websocketClient . Disconnected -= OnWebsocketDisconnected ;
473474 _websocketClient . Dispose ( ) ;
474-
475+
475476 _updateMonitorCts . Cancel ( ) ;
476477 }
477478
@@ -675,7 +676,7 @@ private void OnConnectionConfirmed(EventHealthCheck healthCheckEvent,
675676 LocalUser = healthCheckEvent . Me ;
676677#pragma warning restore 0618
677678 _lastHealthCheckReceivedTime = _timeService . Time ;
678-
679+
679680 ConnectionState = ConnectionState . Connected ;
680681
681682 _connectUserTaskSource ? . SetResult ( eventHealthCheckInternalDto . Me ) ;
@@ -782,41 +783,50 @@ private void RegisterEventHandlers()
782783
783784 RegisterEventType < NotificationMarkReadEventInternalDTO , EventNotificationMarkRead > (
784785 WSEventType . NotificationMarkRead ,
785- ( e , dto ) => NotificationMarkRead ? . Invoke ( e ) , dto => InternalNotificationMarkRead ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
786+ ( e , dto ) => NotificationMarkRead ? . Invoke ( e ) , dto => InternalNotificationMarkRead ? . Invoke ( dto ) ,
787+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
786788 RegisterEventType < NotificationNewMessageEventInternalDTO , EventNotificationMessageNew > (
787789 WSEventType . NotificationMessageNew ,
788790 ( e , dto ) => NotificationMessageReceived ? . Invoke ( e ) ,
789- dto => InternalNotificationMessageReceived ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
791+ dto => InternalNotificationMessageReceived ? . Invoke ( dto ) ,
792+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
790793
791794 RegisterEventType < NotificationChannelDeletedEventInternalDTO , EventNotificationChannelDeleted > (
792795 WSEventType . NotificationChannelDeleted ,
793796 ( e , dto ) => NotificationChannelDeleted ? . Invoke ( e ) ,
794- dto => InternalNotificationChannelDeleted ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
797+ dto => InternalNotificationChannelDeleted ? . Invoke ( dto ) ,
798+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
795799 RegisterEventType < NotificationChannelTruncatedEventInternalDTO , EventNotificationChannelTruncated > (
796800 WSEventType . NotificationChannelTruncated ,
797801 ( e , dto ) => NotificationChannelTruncated ? . Invoke ( e ) ,
798- dto => InternalNotificationChannelTruncated ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
802+ dto => InternalNotificationChannelTruncated ? . Invoke ( dto ) ,
803+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
799804
800805 RegisterEventType < NotificationAddedToChannelEventInternalDTO , EventNotificationAddedToChannel > (
801806 WSEventType . NotificationAddedToChannel ,
802807 ( e , dto ) => NotificationAddedToChannel ? . Invoke ( e ) ,
803- dto => InternalNotificationAddedToChannel ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
808+ dto => InternalNotificationAddedToChannel ? . Invoke ( dto ) ,
809+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
804810 RegisterEventType < NotificationRemovedFromChannelEventInternalDTO , EventNotificationRemovedFromChannel > (
805811 WSEventType . NotificationRemovedFromChannel ,
806812 ( e , dto ) => NotificationRemovedFromChannel ? . Invoke ( e ) ,
807- dto => InternalNotificationRemovedFromChannel ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
813+ dto => InternalNotificationRemovedFromChannel ? . Invoke ( dto ) ,
814+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
808815
809816 RegisterEventType < NotificationInvitedEventInternalDTO , EventNotificationInvited > (
810817 WSEventType . NotificationInvited ,
811- ( e , dto ) => NotificationInvited ? . Invoke ( e ) , dto => InternalNotificationInvited ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
818+ ( e , dto ) => NotificationInvited ? . Invoke ( e ) , dto => InternalNotificationInvited ? . Invoke ( dto ) ,
819+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
812820 RegisterEventType < NotificationInviteAcceptedEventInternalDTO , EventNotificationInviteAccepted > (
813821 WSEventType . NotificationInviteAccepted ,
814822 ( e , dto ) => NotificationInviteAccepted ? . Invoke ( e ) ,
815- dto => InternalNotificationInviteAccepted ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
823+ dto => InternalNotificationInviteAccepted ? . Invoke ( dto ) ,
824+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
816825 RegisterEventType < NotificationInviteRejectedEventInternalDTO , EventNotificationInviteRejected > (
817826 WSEventType . NotificationInviteRejected ,
818827 ( e , dto ) => NotificationInviteRejected ? . Invoke ( e ) ,
819- dto => InternalNotificationInviteRejected ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
828+ dto => InternalNotificationInviteRejected ? . Invoke ( dto ) ,
829+ InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
820830
821831 // Polls
822832
@@ -850,6 +860,13 @@ private void RegisterEventType<TDto, TEvent>(string key,
850860 {
851861 try
852862 {
863+ #if STREAM_DEBUG_ENABLED
864+ var ignoreKeys = new [ ] { WSEventType . HealthCheck } ;
865+ if ( ! ignoreKeys . Contains ( key ) )
866+ {
867+ _logs . Warning ( "WS event received KEY: " + key + " CONTENT: " + serializedContent ) ;
868+ }
869+ #endif
853870 var eventObj = DeserializeEvent < TDto , TEvent > ( serializedContent , out var dto ) ;
854871 postprocess ? . Invoke ( dto ) ;
855872 _lastEventReceivedAt = eventObj . CreatedAt ;
@@ -987,7 +1004,7 @@ private void SetPartialConnectionCredentials(string apiKey, string userId)
9871004 private void LogErrorIfUpdateIsNotBeingCalled ( )
9881005 {
9891006 _updateMonitorCts = new CancellationTokenSource ( ) ;
990-
1007+
9911008 //StreamTodo: temporarily disable update monitor when tests are enabled -> investigate why some tests trigger this error
9921009#if ! STREAM_TESTS_ENABLED
9931010 const int timeout = 2 ;
@@ -1038,7 +1055,7 @@ private static string BuildStreamClientHeader(IApplicationInfo applicationInfo)
10381055
10391056 return sb . ToString ( ) ;
10401057 }
1041-
1058+
10421059 private void OnReconnectionScheduled ( )
10431060 {
10441061 ConnectionState = ConnectionState . WaitToReconnect ;
@@ -1056,4 +1073,4 @@ private void OnReconnectionScheduled()
10561073 _logSb . Clear ( ) ;
10571074 }
10581075 }
1059- }
1076+ }
0 commit comments