WebSockets support #568
-
|
I’m trying to connect to a WebSocket using URLSessionWebSocketTask in native mode with SKIP. On iOS everything works perfectly. Android compiles, but at runtime I get the error: NSLocalizedDescription=WebSockets not supported by libcurl. What’s the recommended way to work with WebSockets in SKIP? Any guidance or example code for a SKIP‑friendly approach would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
WebSockets ought to work, but they aren't enabled in libcurl for the Swift SDK for Android. This is reported at #559. Hopefully it will be a simple matter of turning on the flag (see swift-android-sdk/swift-docker#17), but we'll need to get it into the next version's SDK build, so it might be a little while. In the interim, you might look into using swift-nio's WebSockets support (https://github.com/apple/swift-nio?tab=readme-ov-file#low-level-protocol-implementations), which may work. Also, if you are using any transpiled Skip Lite libraries alongside Skip Fuse, note that our transpiled URLSessionWebSocketTask does work there (see #106 (comment)), and bridges to Android's native websockets implementation. So that could be an option if you want to mix Skip Fuse and Skip Lite libraries. |
Beta Was this translation helpful? Give feedback.
-
|
Big thanks for the detailed answer and the provided references! |
Beta Was this translation helpful? Give feedback.
WebSockets ought to work, but they aren't enabled in libcurl for the Swift SDK for Android. This is reported at #559. Hopefully it will be a simple matter of turning on the flag (see swift-android-sdk/swift-docker#17), but we'll need to get it into the next version's SDK build, so it might be a little while.
In the interim, you might look into using swift-nio's WebSockets support (https://github.com/apple/swift-nio?tab=readme-ov-file#low-level-protocol-implementations), which may work.
Also, if you are using any transpiled Skip Lite libraries alongside Skip Fuse, note that our transpiled URLSessionWebSocketTask does work there (see #106 (comment)), and bridges to Android's native websocke…