gleam_gun/websocket

Types

The URI of the websocket server to connect to

pub type ConnectError {
  ConnectionRefused(status: Int, headers: List(Header))
  ConnectionFailed(reason: Dynamic)
}

Constructors

  • ConnectionRefused(status: Int, headers: List(Header))
  • ConnectionFailed(reason: Dynamic)
pub opaque type Connection
pub type ConnectionOpts {
  Transport(Atom)
  TransportOpts(List(ConnectionOptsTransportOpts))
}

Constructors

  • Transport(Atom)
  • TransportOpts(List(ConnectionOptsTransportOpts))
pub type ConnectionOptsTransportOpts {
  Verify(Atom)
}

Constructors

  • Verify(Atom)
pub type Frame {
  Close
  Text(String)
  Binary(BitArray)
}

Constructors

  • Close
  • Text(String)
  • Binary(BitArray)

Functions

pub fn close(conn: Connection) -> Nil
pub fn connect(
  hostname: String,
  path: String,
  port: Int,
  headers: List(#(String, String)),
  opts: List(ConnectionOpts),
) -> Result(Connection, ConnectError)
pub fn receive(
  from: Connection,
  within: Int,
) -> Result(Frame, Nil)
pub fn send(to conn: Connection, this message: String) -> Nil
pub fn send_binary(
  to conn: Connection,
  this message: BitArray,
) -> Nil
pub fn send_binary_builder(
  to conn: Connection,
  this message: BytesBuilder,
) -> Nil
pub fn send_builder(
  to conn: Connection,
  this message: StringBuilder,
) -> Nil
Search Document