Ircxd.WebSocket (ircxd v1.1.0)

Copy Markdown View Source

Helpers for the IRCv3 WebSocket transport conventions.

The WebSocket spec carries one IRC line per WebSocket message without the trailing CRLF used by TCP transports.

Socket lifecycle is intentionally delegated to adapter modules implementing Ircxd.WebSocket.Adapter, so host applications can use Phoenix Channels or another WebSocket stack without forcing that dependency into this library.

Summary

Functions

Returns the IRCv3 binary WebSocket subprotocol name.

Closes a WebSocket adapter if it implements the optional callback.

Decodes one :text or :binary WebSocket payload as an IRC message.

Encodes one IRC message for a :text or :binary WebSocket frame.

Encodes one IRC line and sends it through a WebSocket adapter.

Returns subprotocol names in preference order.

Returns the IRCv3 text WebSocket subprotocol name.

Functions

binary_subprotocol()

Returns the IRCv3 binary WebSocket subprotocol name.

close(adapter, adapter_state, reason)

Closes a WebSocket adapter if it implements the optional callback.

decode_message(payload, mode \\ :text)

Decodes one :text or :binary WebSocket payload as an IRC message.

encode_line(message_or_line, mode \\ :text)

Encodes one IRC message for a :text or :binary WebSocket frame.

send_frame(adapter, adapter_state, message_or_line, mode \\ :text)

Encodes one IRC line and sends it through a WebSocket adapter.

subprotocols(preferences \\ [:binary, :text])

Returns subprotocol names in preference order.

text_subprotocol()

Returns the IRCv3 text WebSocket subprotocol name.