Skip to content
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

Auto-discovery of websocket implementation dependencies #252

Open
joffrey-bion opened this issue Jul 4, 2022 · 1 comment
Open

Auto-discovery of websocket implementation dependencies #252

joffrey-bion opened this issue Jul 4, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@joffrey-bion
Copy link
Owner

joffrey-bion commented Jul 4, 2022

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)

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

@joffrey-bion joffrey-bion added the enhancement New feature or request label Jul 4, 2022
@joffrey-bion
Copy link
Owner Author

joffrey-bion commented Aug 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant