about summary refs log tree commit diff
path: root/docs/Using-the-API
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-02 16:35:06 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-02 16:35:06 +0100
commitaa2fa227e9cdd5aa4f8facd93775f6180e44a17b (patch)
tree2e7cb7e016c764c820b77bab6f5eb824cef21847 /docs/Using-the-API
parent61ce15d94b7e83fee902290e9466413be218ff87 (diff)
Adding documentation for streaming API. Fixing filtering bug
Diffstat (limited to 'docs/Using-the-API')
-rw-r--r--docs/Using-the-API/Streaming-API.md40
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/Using-the-API/Streaming-API.md b/docs/Using-the-API/Streaming-API.md
new file mode 100644
index 000000000..b6d41ab0e
--- /dev/null
+++ b/docs/Using-the-API/Streaming-API.md
@@ -0,0 +1,40 @@
+Streaming API
+=============
+
+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.
+
+### Endpoints:
+
+**GET /api/v1/streaming/user**
+
+Returns events that are relevant to the authorized user, i.e. home timeline and notifications
+
+**GET /api/v1/streaming/public**
+
+Returns all public statuses
+
+**GET /api/v1/streaming/hashtag**
+
+Returns all public statuses for a particular hashtag (query param `tag`)
+
+### Stream contents
+
+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:
+
+```
+event: name
+data: payload
+
+```
+
+[See MDN](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
+
+### Event types
+
+|Event|Description|What's in the payload|
+|-----|-----------|---------------------|
+|`update`|A new status has appeared!|Status|
+|`notification`|A new notification|Notification|
+|`delete`|A status has been deleted|ID of the deleted status|
+
+The payload is JSON-encoded.