Finally back to using your code and web page example, find that if I connect, send some data, then disconnect, wait a bit, then reconnect to the same device, data will not be sent after the second connect. It fails in your web page terminal example as well as my code which uses your same JS. I have to refresh the screen on your web terminal as well as refresh my page with my code to make the connection and sends work again. It seems like something is not cleared on disconnect that should be cleared, and it takes a refresh to make it work. Please take a look at this. Thank you for your help.
Finally back to using your code and web page example, find that if I connect, send some data, then disconnect, wait a bit, then reconnect to the same device, data will not be sent after the second connect. It fails in your web page terminal example as well as my code which uses your same JS. I have to refresh the screen on your web terminal as well as refresh my page with my code to make the connection and sends work again. It seems like something is not cleared on disconnect that should be cleared, and it takes a refresh to make it work. Please take a look at this. Thank you for your help.