class Phoenix::Push
- Phoenix::Push
- Reference
- Object
Overview
A Push
is returned from Channel#join
, Channel#leave
and Channel#push
calls. Callbacks can be bound to server replies using #receive
.
Defined in:
phoenix/push.crInstance Method Summary
-
#receive(status : String, &block : JSON::Any -> ) : Push
Register a callback for a push reply of a given status
Instance Method Detail
Register a callback for a push reply of a given status
This example shows registering both "ok" and "error" callbacks for a channel join push. This also works for general channel pushes (if configured on the server to reply).
channel.join
.receive "ok" do |response|
puts "Joined successfully: #{response}"
end
.receive "error" do |response|
puts "Unable to join: #{response}"
end