Websocket Heartbeat and how to resubscribe

Using the Platform API notification service, websocket connection, is there an expiry time ?
What does it mean when you stop receiving the heartbeat messages ?

Also, in order to resubscribe to the topics, to keep the channel active, do you use the
PUT /api/v2/notifications/channels/{id}/subscriptions
or the
POST /api/v2/notifications/channels/{id}/subscriptions
or is there another way ?

Thanks,
Kathie

See https://developer.mypurecloud.com/api/rest/v2/notifications/notification_service.html#usage_guidelines

Channels remain active for 24 hours. To maintain a subscription longer, resubscribe to the topic.

If you aren't receiving heartbeat messages, the WebSocket isn't connected.

Either.

Thanks Tim for your reply.
I am resubscribing to the topics with PUT every 12 hours interval, but still see regular disconnects from the channel.
Sometimes I see that there was a POST to subscribe to topics, then within a couple hours, I stop receiving the heartbeats.
Is there anything else I need to do to maintain the channel connection ?

If you're creating too many channels, the oldest channel will be closed when a new one is created over the limit. Could also just be network connectivity issues for the clients having the issue.

If you need assistance troubleshooting why your sockets are closing, please open a case with PureCloud Care to investigate; customer-specific information (like your network details and packet captures) cannot be investigated via the forum.

are the timestamps always in UTC with format iso-8601 ? Would there be a time that includes a timezone ? e.g. 1997-07-16T19:20:30.45+01:00

Timestamps are in ISO-8601 format unless specified otherwise in the documentation. The standard in the API is to use UTC for timestamps, but there may be instances where a different offset is used. A well-formed application will parse the timestamp along with the offset.

Once the heartbeat is gone, does that mean the channel is closed or do we need to explicitly close it ?

The presence or absence of a heartbeat indicates whether or not your WebSocket is functioning properly; it does not indicate the validity of a channel, in either direction.

https://developer.mypurecloud.com/api/rest/v2/notifications/notification_service.html#status_codes

What does a valid channel mean ? And how do you make sure a channel is closed ?

See the link above.

We are seeing a websocket disconnect on a channel, is it possible to reconnect using a new websocket on the same channel ?

Yes.

We tried that and we get an error "Unable to connect to the remote server". Do you know what might be the cause ?

That's likely a networking issue on your end. Make sure your ports and firewalls are open to be able to establish a connection to the specified host/port/protocol.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.