I am experiencing an issue with WebSocket connections when subscribing to call events in Genesys Cloud from an external application.
Below are the details of the issue:
★Issue Description
I am utilizing the following program to establish a WebSocket connection and subscribe to Genesys Cloud notification topics:
--------------------------------------------------------------------------------------
var channel = subscriptionUtil.MakeSubscriptionChannel();
subscriptionUtil.AddTopicToSubscription(loginUser);
var uri = new Uri(channel.ConnectUri);
using (var clientWebSocket = new ClientWebSocket())
var segment = new ArraySegment<byte>(buffer);
var result = await clientWebSocket.ReceiveAsync(segment, cancellationToken);
if (result.MessageType == WebSocketMessageType.Close)
{
logger.Info("WebSocket close message received from Genesys Cloud server. Exit loop");
break;
}
--------------------------------------------------------------------------------------
I expect the WebSocket connection to stay alive continuously for up to 24 hours.
However, in reality, the connection is unexpectedly closed at a high frequency, approximately every two hours,
even though heartbeats appear to be exchanged without any issues.
★Relevant Logs
--------------------------------------------------------------------------------------
INFO Notification received. { MessageType: Text, Count: 82, EndOfMessage: True }
INFO {"topicName": "channel.metadata", "eventBody": {"message": "WebSocket Heartbeat"}}
DEBUG GetNotification start. message: {"topicName": "channel.metadata", "eventBody": {"message": "WebSocket Heartbeat"}}
DEBUG Notification is neither presence notification nor call notification
INFO Notification received. { MessageType: Close, Count: 0, EndOfMessage: True }
INFO WebSocket close message received from Genesys Cloud server. Exit loop
INFO Entered finally block, going to close WebSocket connection
INFO Closed WebSocket connection successfully. state: Closed
--------------------------------------------------------------------------------------
★Question
Could you please explain the possible reasons for these intermittent WebSocket disconnections even though heartbeat messages are being received regularly?
Is there a limitation regarding WebSocket session duration or inactivity timeouts for notification channels in Genesys Cloud?
Is there any recommended practice for keeping the WebSocket connection alive for longer periods?
Any insight into the Genesys Cloud WebSocket session mechanism or potential causes for these disconnections would be highly appreciated.
#PlatformAPI#PlatformSDK#WebMessaging------------------------------
Naoki Ono
------------------------------