Skip to content

Problems with Serial and arduinoWebSockets #180

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

Closed
caballero03 opened this issue Mar 25, 2017 · 2 comments
Closed

Problems with Serial and arduinoWebSockets #180

caballero03 opened this issue Mar 25, 2017 · 2 comments

Comments

@caballero03
Copy link

We are attempting to use arduinoWebSockets in a serial-to-browser bridge. Basically a simple over-the-air serial terminal and control console. Everything serial works well until we use Websockets to send. When we use sendTXT(...) the hardware serial port misses incoming characters randomly due to some kind of interrupt suppression or some other interference.

Do you know what could be causing this? Do you know of a work around? Is this type of thing even possible?

TIA

@Links2004
Copy link
Owner

Links2004 commented Mar 25, 2017

yes its possible, with out seeing the code I can only guess the problem.
but most likely you try to send byte by byte over the web-socked, this generate overhead.
you need to buffer the Incoming data and send it in "blocks",
the TCP layer is not designed to handle many small requests, windows for example sends a TCP ack only when a bigger amount of data is received or after 200ms what is a big pain when you send small or on byte at the time.
The ESP blocks until it gets the ACK.
the lost you see is most likely the RX buffer which is overflowing, during the wait for the ACK.

some code with intelligent buffering can be found her:
#61 (comment)

and you can use the async TCP lib for the ESP to improve the Performance more.
https://github.com/Links2004/arduinoWebSockets#esp-async-tcp

@caballero03
Copy link
Author

Thank you for your fast response. I am sure this will help us out. I cannot explain how that page escaped all of my searching. :-|

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