Topical.Adapters.Plug.WebSockServer (topical v0.2.2)

A WebSocket server for a WebSock service (for use with Plug).

options

Options

  • registry - The name of the Topical registry. Required.
  • init - A function called before upgrading the connection, which is passed the request. The function must return {:ok, context} for the connection to be accepted. This context is then passed to topics.

example

Example

defmodule Router do
  use Plug.Router

  plug :match
  plug :dispatch

  # ...

  get "/socket" do
    conn
    |> WebSockAdapter.upgrade(
      Topical.Adapters.Plug.WebSockServer,
      [registry: MyRegistry],
      timeout: 60_000)
    |> halt()
  end

  # ...
end

Link to this section Summary

Link to this section Functions

Link to this function

handle_in(arg, state)

Link to this function

handle_info(info, state)