Page 1 of 1

MOD 5234 Websockets How to handle connections

Posted: Tue Sep 07, 2021 6:15 pm
by Quickdeploy
We currently have a program that has 2 serial devices and a TCP device that we poll. Part of this data is displayed on the customer web browser on a realtime display. This currently work with the following 2 issues. On this communication is mostly one-way by design from the 5234 server to the client, we don't current have any type of keep alive packet. We have discovered that if you refresh or navigate from the page we use all 4 sockets that are allocated in the .h file. We have increased this to 10 sockets just to experiment. We assume somehow we need to since these connections have become lost and clean them up somehow? We can see ws-fd returns a number and increments up but our unsure how to reclaim the sockets. If we need to we could have a keep alive sent from the browser but then need to know the best way to manage?

The second question and this one is less important as normally our customer uses one PC but is there a we to manage multiusers on websockets?

Today the last one in wins.

Thanks,
David

Re: MOD 5234 Websockets How to handle connections

Posted: Wed Sep 08, 2021 5:12 am
by pbreed
select (see other answer ) is how to manage multiple connections, serial, websocket, tcp etc...

any tcp/ or websocket you open you must close or you have a leak.

with tcp you can detect dead sockets with

DWORD TcpGetLastRxTime( int fd );
void TcpSendKeepAlive ( int fd );

For websockets.... I need to ask the websocket person...


Well get back to you..

Re: MOD 5234 Websockets How to handle connections

Posted: Thu Sep 09, 2021 5:52 pm
by dciliske
Websockets have a Ping/Pong method defined in the spec, which was not fully implemented or exposed through the API. Open a support ticket, and we can send you a patch.

-Dan