ArchAstro.Channel (archastro v0.2.0)

Copy Markdown

A joined Phoenix Channel owned by an ArchAstro.Socket process.

Summary

Types

t()

@type t() :: %ArchAstro.Channel{
  join_response: ArchAstro.JSON.t() | struct(),
  module: module(),
  socket: GenServer.server(),
  topic: String.t()
}

Functions

join(socket, topic, payload, module, descriptor, timeout \\ 5000)

leave(channel, timeout \\ 5000)

@spec leave(t(), timeout()) :: :ok | {:error, ArchAstro.Error.reason()}

push(channel, event, payload, descriptor, timeout \\ 5000)

@spec push(
  t(),
  String.t(),
  ArchAstro.JSON.object() | struct(),
  ArchAstro.Codec.descriptor(),
  timeout()
) ::
  {:ok, ArchAstro.JSON.t() | struct() | :ok}
  | {:error, ArchAstro.Error.reason()}

subscribe(channel, event, subscriber, descriptor)

@spec subscribe(t(), String.t(), pid(), ArchAstro.Codec.descriptor()) :: :ok