Slack. WebSocketClient behaviour
(SlackKit v0.25.0-alpha.0)
View Source
A small WebSocket client process built on top of Mint.WebSocket.
The public surface intentionally mirrors the Erlang :websocket_client
library so that Slack.Bot (and any test stubs that follow the same
contract) can use it as a drop-in replacement:
Slack.WebSocketClient.start_link(url, callback_module, state, opts)
Slack.WebSocketClient.cast(pid, {:text, "..."})Callback modules implement the Slack.WebSocketClient behaviour, which
re-uses the function names from :websocket_client:
init/1onconnect/2ondisconnect/2websocket_handle/3websocket_info/3websocket_terminate/3
Summary
Functions
Sends a frame on the WebSocket. Mirrors :websocket_client.cast/2.
Returns a specification to start this module under a supervisor.
Starts the WebSocket client and connects to url.
Types
Callbacks
@callback websocket_handle(frame(), any(), any()) :: handler_response()
@callback websocket_info(any(), any(), any()) :: handler_response()
Functions
Sends a frame on the WebSocket. Mirrors :websocket_client.cast/2.
Returns a specification to start this module under a supervisor.
See Supervisor.
Starts the WebSocket client and connects to url.
url may be a string or charlist (the latter is accepted for compatibility
with the older :websocket_client callers).
Options
:keepalive- how often (in ms) to send a keepalive ping. Defaults to:infinity(no keepalive).