Newer Version Available
ReconnectSession
This request should only be made if you receive a 503 response status code, indicating that the affinity token has changed for your Live Agent session. When you receive a 503 response status code, you must cancel any existing inbound or outbound requests.
The data in outbound requests will be temporarily stored and resent once the session is reestablished. Upon receiving the response for the ReconnectSession request, you can start polling for messages.
The first response will be a ChasitorSessionData message containing the data from the previous session that will be restored once the session is reestablished. After receiving that message, you can proceed to send the existing messages that were canceled upon receiving the 503 response status code.
Syntax
- URI
- https://hostname/chat/rest/System/ReconnectSession
- Available since release
- This resource is available in API versions 37.0 and later.
- Formats
- JSON
- HTTP methods
- GET
- Request headers
- X-LIVEAGENT-API-VERSION
- X-LIVEAGENT-AFFINITY
- X-LIVEAGENT-SESSION-KEY
- Request parameters
-
Name Type Description ReconnectSession.offset Number The event offset from the most recent Messages request that your client received. - Query parameters
- None
- Request body
- None
- Response body
- ReconnectSession
Example
Your REST client can get a 503 Invalid Affinity Token response, for example, to a long poll request (/chat/rest/System/Messages).
No matter which kind of request gets the 503 response, you must send a /chat/rest/System/ReconnectSession request to finish the handover process.
The ReconnectSession.offset query parameter has to be set to the “offset” parameter of the most recent long poll response that actually contained messages. Empty long poll responses don’t come with an “offset”.
The response to this ReconnectSession request looks like this:
The resetSequence is always set to true. Therefore, reset the sequence number of the next request and store the value in affinityToken to use in the X-LIVEAGENT-AFFINITY header for all future requests. Once another handover process occurs the resetSequence is updated again.