View Source ActivityPubClient.SyncServer (ActivityPubClient v0.1.1)

GenServer used to keep a WebSocket connection to an ActivityPub instance.

Reference: https://docs.joinmastodon.org/methods/timelines/streaming/#websocket-a-idwebsocketa

With inspiration from: https://github.com/GamgeeNL/websocket-client

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Upgrades the connection to WebSocket.

Starts a SyncServer process.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Upgrades the connection to WebSocket.

Link to this function

start(client, type, callback \\ nil)

View Source

Starts a SyncServer process.

Expects:

  • an %OAuth2.Client{} struct as returned by Client,
  • the type of streaming, can be one of:
    • user
    • public
    • public:local
    • hashtag
    • hashtag:local
    • list
    • direct
  • an optional callback, which will be called when the WebSocket receives data. In the absence of a callback, the will send a message to the process that calls open_ws/1.