You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

  1. Streaming API
  2. =============
  3. Your application can use a server-sent events endpoint to receive updates in real-time. Server-sent events is an incredibly simple transport method that relies entirely on chunked-encoding transfer, i.e. the HTTP connection is kept open and receives new data periodically.
  4. ### Endpoints:
  5. **GET /api/v1/streaming/user**
  6. Returns events that are relevant to the authorized user, i.e. home timeline and notifications
  7. **GET /api/v1/streaming/public**
  8. Returns all public statuses
  9. **GET /api/v1/streaming/hashtag**
  10. Returns all public statuses for a particular hashtag (query param `tag`)
  11. ### Stream contents
  12. The stream will contain events as well as heartbeat comments. Lines that begin with a colon (`:`) can be ignored by parsers, they are simply there to keep the connection open. Events have this structure:
  13. ```
  14. event: name
  15. data: payload
  16. ```
  17. [See MDN](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
  18. ### Event types
  19. |Event|Description|What's in the payload|
  20. |-----|-----------|---------------------|
  21. |`update`|A new status has appeared!|Status|
  22. |`notification`|A new notification|Notification|
  23. |`delete`|A status has been deleted|ID of the deleted status|
  24. The payload is JSON-encoded.