-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Feature Request: Support for Custom NSURLSessionConfiguration in Native WebSocket Implementation #111
Feature Request: Support for Custom NSURLSessionConfiguration in Native WebSocket Implementation #111
Conversation
To example added websocket proxy params setup
Hello @shalom-aviv Many thanks for PR! Just letting you know I noticed it, will try to review it as soon as I can, but may take a bit more time than usual these days. |
No problem |
@FZambia Hey |
Hello, this year definitely :) Sorry, really busy working on v6 + holidays. Will come back to this very soon! |
Happy New Year! 🥳 |
…e all icon variations from a single 1024×1024 pixel image. https://developer.apple.com/documentation/xcode/configuring-your-app-icon#Specify-app-icon-variations
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.
👍 Many thanks!
Reason for Changes
We encountered an issue on iOS versions earlier than iOs 17. In these versions, system-wide proxy settings are not applied to new instances of URLSessionWebSocketTask. This means that if the application relies on system-level proxy configurations, the WebSocket connections will bypass them.
To enable proxying for iOS versions below 17, proxy settings must be explicitly provided when creating the URLSession. Without this capability, developers cannot ensure that WebSocket traffic respects proxy configurations, leading to potential security and compliance issues in controlled network environments.
This limitation makes it critical to allow developers to pass a custom NSURLSessionConfiguration to the NativeWebSocket implementation.
proxyman: Capture WS/WSS from iOS
Description
Currently, the NativeWebSocket implementation uses URLSessionConfiguration.default for its NSURLSessionConfiguration. While this works for standard use cases, it becomes a limitation for advanced configurations where custom settings (e.g., proxy settings) are required. Without a way to inject a custom NSURLSessionConfiguration, developers are forced to use method swizzling, which is not ideal because:
To address this, I have implemented changes that allow developers to pass a custom NSURLSessionConfiguration through the WebSocketTransport configuration. These changes are backward-compatible and provide a more flexible approach for advanced configurations.
Key Features Added:
• Developers can now pass a custom URLSessionConfiguration provider to the NativeWebSocket through the WebSocketTransport configuration.
• Example use case: Adding proxy settings to the WebSocket connection.
• The default behavior remains unchanged, using URLSessionConfiguration.default if no custom provider is specified.
Code Changes:
Extended Example, now user can specify proxy params for centrifuge client.
Risks or Considerations:
• Potential Misuse of Configuration Provider: Developers need to ensure the custom URLSessionConfiguration is well-defined, as incorrect configurations could cause unexpected behavior.
Screenshot Descriptions
Below are screenshots to assist with configuring Charles Proxy and testing proxying of WebSocket traffic for CentrifugeClient:
1. Charles Proxy Configuration:
• The Charles Proxy server is set up on the local IP address 192.168.1.80 and listens for traffic on port 8889.
• The screenshot shows the necessary settings in the Charles application to enable WebSocket proxying.
2. Captured Traffic in Charles:
• This screenshot demonstrates successful interception of WebSocket traffic between the CentrifugeClient and the Centrifugo server.
• The server hosting Centrifugo is running on 192.168.1.136 with port 8000.
3. Application Proxy Settings:
• Screenshots show the proxy settings applied directly within the application using the urlSessionConfigurationProvider configuration.