You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could provide a StompClient() factory function without WebSocketClient argument, which would discover an implementation automatically the same way ServiceLoader does on the JVM.
Ktor's HttpClient() factory function uses a ServiceLoader on JVM, and some interesting eager-initialization shenanigans to register implementations in a list and get a similar effect on Kotlin/Native. On JS, they only have one implementation. Maybe we could pull off something similar on JS too nonetheless (however, see issue KT-51626 and its workaround)
A possible approach would be to use https://github.com/whyoleg/sweet-spi.
This library wraps all the hacks in a neat API, which is exactly what we would need.
We could provide a
StompClient()
factory function withoutWebSocketClient
argument, which would discover an implementation automatically the same wayServiceLoader
does on the JVM.Ktor's
HttpClient()
factory function uses aServiceLoader
on JVM, and some interesting eager-initialization shenanigans to register implementations in a list and get a similar effect on Kotlin/Native. On JS, they only have one implementation. Maybe we could pull off something similar on JS too nonetheless (however, see issue KT-51626 and its workaround)For reference, here is my issue on the Kotlin YouTrack for adding a multiplatform equivalent to the JVM's
ServiceLoader
:https://youtrack.jetbrains.com/issue/KT-53056/Multiplatform-equivalent-of-JVMs-ServiceLoader
The text was updated successfully, but these errors were encountered: