Hello Leaf team,
We are experiencing issues where subscriptions to dataChangeEvents stop receiving updates after some period of time. Usually between 10-30mins. We are subscribing to dataChangeEvents with a dataObjectQuery, like so
const { dataObjects} = useDataObjects({
dataObjectService: services.dataObjectService,
dataObjectQuery
dataChangeEventManager,
});
The dataChangeEventManager is created like so
const {
dataChangeEventManager,
streamDataManager,
} = Configure.createWebSocketDataChangeEventManager(wsUrl, DEFAULT_USER);
In certain areas of our app we have implemented a custom polling solution to work around this. However the majority of the app relies on the subscription created from the useDataObjects hook.
Are there any other solutions to this besides polling? Is it possible to periodically re-enable a subscription?
Hello @jacob.i.bostwick,
Just to make sure I understand the problem correctly, during this 10-30 minutes, is your app actively being used, or is it idle for some or all of that time?
The issue here could be your browser, as if you are not actively using a tab and it is in the background, it will sever websocket connections.
It could also be the stability of your network, as any blip in connectivity will cause the websocket connection to drop. If this is the case, we do have a way of setting up your DCEM to automatically reconnect when that happens. If you follow the instructions on the Client Setup Page Example on the “Reconnect Logic” tab, that should set it up for you.
Here is the code that would replace your send code snippet:
const { streamDataManager, dataChangeEventManager } =
Configure.webSocketEventManager(wsUrl, DEFAULT_USER);
I’m running a repeating curl request and keeping the application active just to confirm this is not the issue. I’ll get back to you with results
1 Like