lemunozm / message-io

Fast and easy-to-use event-driven network library.
Apache License 2.0
1.11k stars 74 forks source link

Compiling message-io with just `websocket` feature breaks. #98

Closed entropylost closed 3 years ago

entropylost commented 3 years ago

Error message:

error[E0433]: failed to resolve: could not find `tcp` in `super`
   --> /home/redact/.cargo/registry/src/github.com-1ecc6299db9ec823/message-io-0.14.1/src/adapters/ws.rs:183:45
    |
183 |                     let tcp_status = super::tcp::check_stream_ready(&stream.0);
    |                                             ^^^ could not find `tcp` in `super`

This might be intended, but in that case there should be websocket = ["tcp"]. It also doesn't make sense for the web either. Maybe have two different websocket features? websocket and websocket-web.

lemunozm commented 3 years ago

Ouch! This is due to a recent refactorization. I will fix it ASAP!

Thanks!!

lemunozm commented 3 years ago

As you suggested, this https://github.com/lemunozm/message-io/pull/99 fixes the compilation issue.

Regarding your comment, why you say that this change doesn't make sense for the web? Maybe i'm not understanding something

entropylost commented 3 years ago

Websocket seemed to be an implementation of websocket not bindings to web_sys's websocket?

lemunozm commented 3 years ago

Sorry, I didn't understand you well. Yes, the message-io implementation is based in tungstenite-rs. which seems to not support wasm.

The idea will be to detect the current platform and swap the WebSocket adapter implementation from tungstenite to some other crate as web-sys or ws_stream_wasm. At this moment you can not use WebSocket with wasm. Sorry for the inconvenience. I will create a new issue to tackle this feature.

lemunozm commented 3 years ago

I close this issue (since the compilation problem is solved) and open https://github.com/lemunozm/message-io/issues/100 instead to tracking the wasm support