What are Ably Presence action numbers?

65 Views Asked by At

So I'm pushing Ably Presence events to a lambda function via Ably Firehouse. Logging the event on lambda, I see the presence actions are represented by numbers and not action names (leave, enter...) but I'm not sure what actions each number represents.

Below is the event log on lambda.

 body: '{"source":"channel.presence","appId":"appId","channel":"room:0685f760-f2c9-423b-b44c-19bbefc60358","site":"eu-central-1-A","ruleId":"TtncNQ","presence":[{"id":"WR4hNYLhh-:5:0","clientId":"42e00149-6fbc-4d19-8984-dce2b41d4474","connectionId":"WR4hNYLhh-","timestamp":1695474395301,"encoding":"json","data":"{\\"id\\":\\"42e00149-6fbc-4d19-8984-dce2b41d4474\\",\\"username\\":\\"jondoe\\",\\"firstName\\":\\"Joh\\",\\"lastName\\":\\"Nameless\\"}","action":3}]}',

Playing with my app and observing the logs, it appears that the number 2 represents "Enter" event while 3 represents "Leave". But I wish to have a concrete guide.

1

There are 1 best solutions below

0
Rome time traveler On BEST ANSWER

The Ably presence action are:

0: ABSENT, 
1: PRESENT,
2: ENTER,
3: LEAVE,
4: UPDATE

In practice you should see only 2,3 and 4.

Source: Ably documentation