Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send session started events to the API #11

Open
aleks-tpom6oh opened this issue Jan 17, 2022 · 0 comments · Fixed by #14
Open

Send session started events to the API #11

aleks-tpom6oh opened this issue Jan 17, 2022 · 0 comments · Fixed by #14

Comments

@aleks-tpom6oh
Copy link
Contributor

aleks-tpom6oh commented Jan 17, 2022

Client should group event schemas into sessions.

Session is a rolling 5 minutes window. If an event schema is send before 5 minutes from the last event schema passed - it's the same session.
If an event is sent after 5 minutes since previous event - it's a new session.

Also, if it is a first event schema sent from current app instance - it's a new session.

Session is identified by a session id - a UUID.

API doc

Endpoint: api.avo.app/inspector/v1/track
Method: POST

Every time new session starts we need to send the following payload to the API:

{
  [
    {
      "appName": ...,
      "appVersion": ...,
      "libVersion": ...,
      "libPlatform": "flutter",
      "apiKey": ...,
      "sessionId": "11332f62-ba2d-11eb-8529-0242ac130003", // UUID
      "messageId": "4cffbdca-ba2e-11eb-8529-0242ac130003", // UUID
      "createdAt": "yyyy-mm-ddThh:mm:ss.SSSZ",
      "type": "sessionStarted",
    },
  ]
}
### HTTP Responses

- Server returns a `200` response for successful API requests.
- Server returns a `400` response for invalid requests.
Invalid requests include:
    - `Content-type header missing`
    - `Invalid API key

Write tests for the session tracking and the payload generated for the API calls.

Reference

https://github.com/avohq/node-avo-inspector/blob/main/src/AvoSessionTracker.ts
https://github.com/avohq/node-avo-inspector/blob/main/src/__tests__/Sessions.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant