- 
                Notifications
    
You must be signed in to change notification settings  - Fork 227
 
V5: Use web-socket client from StreamCore #3861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v5-stream-core-json
Are you sure you want to change the base?
Conversation
| 
          
 Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the  You can disable this status message by setting the  ✨ Finishing touches🧪 Generate unit tests (beta)
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment   | 
    
          
 
 Generated by 🚫 Danger  | 
    
…tion" This reverts commit 7e38507.
          SDK Performance
  | 
    
| set { connectionQueue.async(flags: .barrier) { self._connectionId = newValue }} | ||
| } | ||
| 
               | 
          ||
| let webSocketConnectEndpoint = AllocatedUnfairLock<Endpoint<EmptyResponse>?>(nil) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Endpoint used to be in WebSocketClient, but the one from StreamCore does not use endpoint type, so this logic was moved to here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, and it would make it easier to migrate away from endpoints to generated code.
| let event = ConnectionStatusUpdated(webSocketConnectionState: state) | ||
| if event.connectionStatus != connectionStatus { | ||
| // Publish Connection event with the new state | ||
| webSocketClient?.publishEvent(event) | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to be in WebSocketClient. Since this is a custom event, I left it here instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
| syncRepository.syncLocalState { | ||
| log.info("Local state sync completed", subsystems: .offlineSupport) | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was in WebSocketClient, now it is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is chat specific logic
| 
               | 
          ||
| /// The type is designed to pre-process some incoming `Event` via middlewares before being published | ||
| class EventNotificationCenter: NotificationCenter, @unchecked Sendable { | ||
| class PersistentEventNotificationCenter: NotificationCenter, EventNotificationCenter, @unchecked Sendable { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easier to have a different type than trying to migrate this to StreamCore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✅
| set { connectionQueue.async(flags: .barrier) { self._connectionId = newValue }} | ||
| } | ||
| 
               | 
          ||
| let webSocketConnectEndpoint = AllocatedUnfairLock<Endpoint<EmptyResponse>?>(nil) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, and it would make it easier to migrate away from endpoints to generated code.
| let event = ConnectionStatusUpdated(webSocketConnectionState: state) | ||
| if event.connectionStatus != connectionStatus { | ||
| // Publish Connection event with the new state | ||
| webSocketClient?.publishEvent(event) | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
| syncRepository.syncLocalState { | ||
| log.info("Local state sync completed", subsystems: .offlineSupport) | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is chat specific logic
          SDK Size
  | 
    
          StreamChat XCSize
 Show 231 more objects
  | 
    
          StreamChatUI XCSize
 Show 292 more objects
  | 
    
          Public Interface- public enum ConnectionStatus: Equatable, Sendable  
- 
-   case initialized
-   case disconnected(error: ClientError? = nil)
-   case connecting
-   case connected
-   case disconnecting
- public protocol Event: Sendable
- public struct APIKey: Equatable, Sendable  
- 
-   public let apiKeyString: String
-   
- 
-   public init(_ apiKeyString: String)
- public final class IgnoredEventType: ClientError, @unchecked Sendable  
- 
-   override public var localizedDescription: String
 public final class HealthCheckEvent: ConnectionEvent, EventDTO, Sendable  
+   
+ 
+   public func healthcheck()-> HealthCheckInfo? | 
    
          
 | 
    



🔗 Issue Links
Fixes IOS-1205
🎯 Goal
Use WebSocketClient from StreamCore which has slightly different interface
📝 Summary
Provide bullet points with the most important changes in the codebase.
🛠 Implementation
Provide a detailed description of the implementation and explain your decisions if you find them relevant.
🎨 Showcase
Add relevant screenshots and/or videos/gifs to easily see what this PR changes, if applicable.
🧪 Manual Testing Notes
Explain how this change can be tested manually, if applicable.
☑️ Contributor Checklist
docs-contentrepo