Skip to content
Strata is pre-1.0. APIs, protocol, and storage format may change.

strata_transport_gun

strata_transport_gun targets Erlang. It uses gluegun to connect to a WebSocket server and receive text frames.

  • options() -> Options uses a five-second timeout and plain TCP.
  • with_timeout(options, timeout) -> Options changes the connect timeout.
  • with_secure(options, secure) -> Options selects TLS or plain TCP.
  • connection_path(path, token) -> String builds the WebSocket path and percent-encodes the token query value once.
  • open_socket(...) -> Result(Socket, GluegunError) connects with that encoded path and starts a receive process.
  • send_text(socket, text) -> Result(Nil, GluegunError) sends one text frame.
  • close(socket) -> Result(Nil, GluegunError) closes the WebSocket.

CloseEvent is Closed or Failed(GluegunError).

See Erlang and Gun Transport for a connection example.

Source: packages/strata_transport_gun.