FedecksClient.Websockets.WebsocketUrl (fedecks_client v0.1.0)

Holds and validates websocket url in a way that is useful for using with Mint Websockets.

Struct values:

  • scheme: either atoms :ws or :wss
  • http_scheme: if scheme is :ws then http, otherwise https. Used by establish the initial Mint connection before upgrade
  • port: the TCP port (obvs)
  • path: Path part of theurl (obvs)

Link to this section Summary

Functions

Parses and validates a String websocket url.

Link to this section Types

@type t() :: %FedecksClient.Websockets.WebsocketUrl{
  host: term(),
  http_scheme: :http | :https,
  path: String.t(),
  port: non_neg_integer(),
  scheme: :ws | :wss
}

Link to this section Functions

Link to this function

new(string_url)

@spec new(url :: String.t()) :: {:ok, t()} | {:error, reason :: String.t()}

Parses and validates a String websocket url.

  • Only ws and wss schemes are accepted.
  • Host is required.
  • Port is dreived from the scheme, is not part of the url
  • Path is normalised to "/" if it is absent