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

Wrong data sent to C++ libWebSockets server #51

Closed
Gleeno opened this issue Feb 6, 2016 · 4 comments
Closed

Wrong data sent to C++ libWebSockets server #51

Gleeno opened this issue Feb 6, 2016 · 4 comments

Comments

@Gleeno
Copy link

Gleeno commented Feb 6, 2016

I' m using esp8266 with this library to connect as a client to a C++ websocket server.
With "WebSocketClient" example, connection and handshake complete successfully, but when I send a simple text message (like "hello"), the C++ server receive the "hello" text, plus some incomprehnsible characters.
In addition, my server crash because the message is always bigger than buffer of server, whatever the size.
All libs are RFC6455 (websocket v13) compilant.
Here part of ESP8266 log:

[WS-Client][handleHeader] Websocket connection init done.
[WS][0][headerDone] Header Handling Done (0us).
Connection: Upgrade
[WS-Client][handleHeader] RX: Sec-WebSocket-Accept: wF4RQ16RitGys2E5mhs0fSeme] fin: 1 opCode: 2 mask: 1 length: 1 headerToPayload: 0
[WS][0][sendFrame] pack to one TCP package...
JUSM=
[WS-Client][handleHeader] RX: Sec-WebSocket-Protocol: instruction_protocol
[WS-Client][handleHeader] Header read fin.
[WS-Client][handleHeader] Client[WSc] Connected to url: /
[WS][0][sendFrame] ------- send massage frame -------
[WS][0][sendFra[WS][0][sendFrame] sending Frame Done (42313us).
[WS-Client] connection lost.
[WS-Client] client disconnected.
[WSc] Disconnected!

And here C++ Server

[1454767129:5654] NOTICE: Libwebsockets version: 1.6.0 5086597
[1454767129:5654] NOTICE: IPV6 not compiled in
[1454767129:5654] NOTICE: libev support not compiled in
[1454767129:5654] NOTICE: Threads: 1 each 4096 fds
[1454767129:5654] NOTICE: mem: platform fd map: 32768 bytes
[1454767129:5654] NOTICE: mem: per-conn: 368 bytes + protocol rx buf
[1454767129:5655] NOTICE: canonical_hostname = teo-laptop
[1454767129:5655] NOTICE: Compiled with OpenSSL support
[1454767129:5655] NOTICE: Using non-SSL mode
[1454767129:5669] NOTICE: Listening on port 9002
Client connected. Ip: 192.168.1.9 Name: ESP_D56E95
Instr: size=3002370 and cont=s
RUN FINISHED; Aborted; real time: 4s; user: 0ms; system: 0ms

Someone can help me ?

@Links2004
Copy link
Owner

your log from the ESP looks like the serial has lost some data.
[WS][0][sendFra[WS][0][s and here: RQ16RitGys2E5mhs0fSeme] fin:
which version of the WS and core are you using?
and in which mode sync or async TCP?

@Gleeno
Copy link
Author

Gleeno commented Feb 6, 2016

Version of WS is 1.4, last commit, TCP in sync mode.
Version of Arduino core for ESP8266 is 2.1.0-rc2.
Message sent is the character "s"

@Links2004
Copy link
Owner

have send the message (s) from ESP in client and server mode not have any problems here.
server is nodejs, and client is chrome.

can you check if nodejs is working as server in you case?
https://github.com/Links2004/arduinoWebSockets/tree/master/tests/webSocketServer

@Gleeno
Copy link
Author

Gleeno commented Feb 8, 2016

Yes, it works with node.js, so i suppose it's cpp libewbsockets issue. Thanks.

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

No branches or pull requests

2 participants