Cancel
Showing results for 
Search instead for 
Did you mean: 

Websocket Timeout

Pioneer
Pioneer

Hi everyone,

We have written web sockets using Spring Websocket API  (org.springframework.web.socket)using Jdk 1.8 and deployed on Mindsphere. 

Websocket is working fine on the local system while after deployment to Mindsphere our WS connection gets disconnected after 27 minutes. Looks like Mindsphere Gateway is not allowing long-lived WS sessions. I am testing it using Chrome WS extension. 

Should I try with some sessions setting?

 

Has anyone done a similar sort of things? Suggestions are most appreciated. 

 

Thanks and regards

Divya Garg 

2 REPLIES 2

Re: Websocket Timeout

Legend
Legend

AFAIK all mdsp gateway connections timeout at 30 minutes of inactivity:

https://developer.mindsphere.io/howto/howto-local-development.html#accessing-mindsphere-apis-using-s...

 

You could use a keepalive from your client to avoid this timeout. In any case there's a maximum 12 hours validity for the token, you'll need to re-authenticate after that.

Re: Websocket Timeout

Experimenter
Experimenter

Hello @divgcet1 !

That 27 minute timeout is oddly specific. For websockets, the underlying http session is refreshed every 1620000 milliseconds, which is 27 minutes, just 3 minutes before it should expire. 

May I ask how your application is using websockets?
I would like to know the following:

- What protocol are you using on your websocket connection?

- While your application is using websockets, does it still use regular HTTP requests, and if so, how frequently? 

- Does your application send a ping message in every minute on the websocket connection?
- Can your application send a websocket message after 20 seconds, 120 seconds, 10 minutes, 20 minutes, 30 minutes and 120 minutes?


If the connection is cut exactly at 27 minutes, regardless of the frequency of your websocket messages, then please file a bugreport.