Hei Guys,
i'm building my own websocket server, to learn something.
Now i currently have a java socket server which establishes successful with my client but when i send with my client "test", i receive something like "?„þdl»ŠÏ". It is always a different receive.
There is no line end, nothing. I'm reading it out with inputstream.read(). The handshake is in plain text and works wonderful.
I've looked at websocket data format, but i don't get how i should use it.
Slightly duplicate with Websocket Java Server. Not sending message nor receiving --> but I don't get it, anyway.
Thanks for any suggestions!
The data that the client sends is masked. You must get the data from the frame and unmask it.
The unmask function should be something like this:
var DECODED = "";
for (var i = 0; i < ENCODED.length; i++) {
DECODED[i] = ENCODED[i] ^ MASK[i % 4];
}
This is a tutorial of how to develop a WebSocket server in C# , probably very similar to Java.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.