MOD 5234 Websockets How to handle connections

Discussion to talk about software related topics only.
Post Reply
Quickdeploy
Posts: 5
Joined: Fri Sep 03, 2021 10:12 pm

MOD 5234 Websockets How to handle connections

Post 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
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: MOD 5234 Websockets How to handle connections

Post 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..
User avatar
dciliske
Posts: 624
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: MOD 5234 Websockets How to handle connections

Post 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
Dan Ciliske
Project Engineer
Netburner, Inc
Post Reply