Reddit
Puneet bhatt- GET /api/v1/me : Profile, Friends, Karma
- GET /user/username : About,
live threads
Real-time updates on reddit.
In addition to the standard reddit API, WebSockets play a huge role in reddit live. Receiving push notification of changes to the thread via websockets is much better than polling the thread repeatedly.
To connect to the websocket server, fetch /live/thread/about.json and get the websocket_url
field. The websocket URL expires after a period of time; if it does, fetch a new one from that endpoint.
Once connected to the socket, a variety of messages can come in. All messages will be in text frames containing a JSON object with two keys: type
and payload
. Live threads can send messages with many type
s:
update
- a new update has been posted in the thread. thepayload
contains the JSON representation of the update.activity
- periodic update of the viewer counts for the thread.settings
- the thread's settings have changed. thepayload
is an object with each key being a property of the thread (as inabout.json
) and its new value.delete
- an update has been deleted (removed from the thread). thepayload
is the ID of the deleted update.strike
- an update has been stricken (marked incorrect and crossed out). thepayload
is the ID of the stricken update.embeds_ready
- a previously posted update has been parsed and embedded media is available for it now. thepayload
contains aliveupdate_id
and list ofembeds
to add to it.complete
- the thread has been marked complete. no further updates will be sent.
Moderation &
r/subreddits info