-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Can this support wasmJs? #64
Comments
Hello, WASM is not currently on the supported target list. It would be interesting to explore as a future supported target but it's not currently in the plans. |
As WASM is gaining more and more popularity it would be nice to see support for it here. |
Hi @davidepianca98 thanks for the awesome library! This led me to how you implemented the current Websocket connection on the other platforms and saw that you are essentially implemented the HTTP protocol messaging and then requesting an upgrade to a Websocket, which you then handle essentially the same as a socket after the Websocket establishment. Given that it is not possible to get a TCP socket in the browser and that the code in the library uses a "socket" abstraction, this blocks the establishment of a Websocket in the browser directly and passing that to the rest of the code as an abstraction. This brings up the question, why do any of the UDP, TCP, TLS socket things per platform and not just use Ktor to do that for you? This would get rid of a lot of platform specific code, leading to a lower maintenance burden and also opens up the possibility for more platforms to be supported. I realise that this would be a major change in the repository though, but I would be more than happy to help out with this effort. |
@Phaestion hello. When I initially made this library 5 years ago, I looked into using Ktor but they didn't provide the lower level networking APIs, it was just an HTTP library. Now I am not sure whether they do, but if they support both client and server for the supported platforms it would be awesome to finally be able to get rid of the lower level layer here. Unfortunately you can see that my ability to maintain this repository has been very limited in the last few months, so I very much welcome any PR that addreses any of the current issues. |
That totally makes sense @davidepianca98. Regarding the supported platforms. Ktor client supports JVM, JS (browser and Node), WASM and all Native platforms If moving to ktor the client would gain JS Browser and WasmJS support. The broker would gain WasmJS support, however it would lose NodeJS and Mingw support. Would that be something that would be ok for you? |
Just adding to my previous comment, both ktor server and client have TCP, UDP, TLS sockets support. Of course also Websocket support. |
@Phaestion I think it's a bit unfortunate that mingw support for the broker would not be available, but I checked the ktor documentation for the sockets library and I think it's worth it. I don't know whether anyone is actually using the nodejs broker, but I consider it a really low priority target, so losing that is fine. |
Hi, It's a great project, but when I try to use it in my Compose Multiplatform project, which includes wasmJs platrom, I ran into this problem
Build Error Log:
:shared:wasmJsMain: Could not resolve io.github.davidepianca98:kmqtt-common:0.4.8.
Required by:
project :shared
The text was updated successfully, but these errors were encountered: