lemunozm / message-io

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

the websocket server not revice data #106

Closed lingfan closed 3 years ago

lingfan commented 3 years ago

http://www.easyswoole.com/wstool.html

the websocket server not revice data

let addr = SocketAddr::from(([0, 0, 0, 0], 65400)); let mut addrs_iter = addr.to_socket_addrs().unwrap();

let transport = Transport::Ws;

let addr1 = addrs_iter.next().unwrap(); server::run(transport, addr1);

image

lemunozm commented 3 years ago

Hi @lingfan

Websocket only uses the binary message type for communication. Probably I should clarify it in the documentation. As I have seen in the wstool, the websocket message is sent in text mode and then discarded by message-io.

The reason for using binary mode instead of text mode is that message-io is transport-independent and treats the message with the same level of information as UDP or TCP handle it, binary raw message. Is it on the user side how to interpret the message. In future versions of message-io, you could parameterize transports to specify this kind of configuration, but for now, only binary websocket messages are interpreted as user data.

lingfan commented 3 years ago

the binary is very good! thanks my test is running image