class

Phoenix::Channel

Inherits Reference < Object

Constructors

new(topic : String, params : JSON::Any, timeout : Time::Span = 10.seconds, rejoin_after : Proc(Int32, Time::Span) = Timer::DEFAULT_BACKOFF)
Source

Instance methods

handle_message(msg : Message) : Nil

Main message dispatcher called by Socket

Source
join(timeout : Time::Span = @timeout) : Push
Source
join_ref
Source
joined?
Source
leave(timeout : Time::Span = @timeout) : Push
Source
off(event : String, ref : Int32 | Nil = nil) : Nil
Source
on(event : String, type : T.class, &callback : T -> ) : Int32 forall T

Typed event subscription

Source
on(event : String, &callback : JSON::Any -> ) : Int32

Untyped event subscription

Source
on_close
Source
on_error
Source
push(event : String, payload : JSON::Any, timeout : Time::Span = @timeout) : Push
Source
rejoin

Called by Socket after reconnecting to re-join channels that were previously joined or errored. Does nothing if the user explicitly left or never joined.

Source
socket
Source
socket=(socket : Socket | Nil)
Source
state
Source
topic
Source
trigger(event : String, payload : JSON::Any, ref : String | Nil = nil) : Nil

Called by Socket when a message arrives for this channel's topic

Source
trigger_error(reason : String) : Nil

Transition to errored state and fire phx_error bindings

Source
trigger_join_reply(payload : JSON::Any) : Nil

Called by tests (and internally) to simulate join reply

Source

Nested types