Amber::WebSockets::Channel
Sockets subscribe to Channels, where the communication log is handled. The channel provides functionality
to handle socket join handle_joined and socket messages handle_message(msg).
Example:
class ChatChannel < Amber::Websockets::Channel
def handle_joined(client_socket)
# functionality when the user joins the channel, optional
end
def handle_leave(client_socket)
# functionality when the user leaves the channel, optional
end
# functionality when a socket sends a message to a channel, required
def handle_message(msg)
rebroadcast!(msg)
end
end
Constructors
Instance methods
handle_leave(client_socket)
Sourcehandle_message(client_socket, msg)
Sourceon_message(client_socket_id, message)
Called from proc when message is returned from the pubsub service