Cloud Development Kit

CDK, using websockets from a server

Hi There, 

Earlier we were using cdk REST APIs to recognize handwritten strokes on our server. Can we use WebSocket API for the same? Also, do I need to disconnect and reconnect the websocket connection after 5 minutes or can I continue using the same connection for extended durations? I understand that the requested is counted for every 5 minutes, but can the connection remain open for longer durations?


Thanks,


Dear Pawan,

of course, you can use our WebSocket API for the same purpose. You do not need to disconnect after 5 minutes, it it just that a new request will be counted. There is no maximum time-limitation, except that a new request will be counted each 5 minutes.

Best regards,

Olivier

Hey Oliver,

Thanks for the quick revert. In our limited test, what we have observed is that if the websocket connection is kept open, at around 300 seconds, we get an error message

{"type":"error","error":{"result":{"error":"WebsocketSessionException","message":"Text websocket session time limit exceeded ","status":"error"}}}

Thanks.

Hey Oliver, Any update on the error? Let me know if we are missing anything. Thanks,
Dear Pawan,

my fault, I thought the websocket was not destroyed after 5 minutes.

Indeed, after 5 minutes, a new websocket has to be re-created. To detect when the websocket expires, either you set a timer on your side, and when the timer expires, you re-create a socket, or you catch the WebsocketSessionException exception,  and re-create a socket.

Best regards,

Olivier
Login or Signup to post a comment