Notifications¶
After creating a play session, clients can subscribe to event notifications related to that session by opening a websocket connection to the link provided by the session response data.
Currently, there are two types of event notifications that the server may send: SessionExpiringEvent
and SessionEndedEvent
.
Session Expiring¶
The SessionExpiringEvent
notification alerts that the session will soon expire due to player inactivity. The message that gets sent through the websocket looks like the following json:
{ "Type": "SessionExpiringEvent", "Payload": { "SessionId": "SomeId-xxxx", "Player": { "Id": "SomeId-xxxx", "Name": "Some User", }, "ExpiresAt": "20017-01-01T13:00:54.931185Z" } }
The ExpiresAt
property is the absolute expiration time upon which the session is going to automatically end by the server, unless the player takes an action (either taking a shot or explicitly request to keep the session alive).
Session Ended¶
The SessionEndedEvent
notification provides information that the player's session has ended. The reason is part of the event data and it can be because the session timed-out due to player inactivity or the player explicitly ended the session. Finally, another reason why a session may have ended, is because the current player has been idle long enough so that his bay became claimable by another player and that player started a new session at that bay.
The message that gets sent through the websocket looks like the following json:
{ "Type": "SessionEndedEvent", "Payload": { "SessionId": "SomeId-xxxx", "Player": { "Id": "SomeId-xxxx", "Name": "Some User", }, "EndedAt": "20017-01-01T13:00:54.931185Z", "Reason": "Timeout" } }
The Reason
property is an enumeration that can have the following self-explanatory values: Timeout
, BayClaimedByOtherPlayer
, Explicit
.