abstract class Lattice::Channel
- Lattice::Channel
- Reference
- Object
Overview
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(message)
.
class ChatChannel < Lattice::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(message)
rebroadcast!(message)
end
end
Defined in:
lattice/channel.crConstructors
Instance Method Summary
-
#handle_joined(client_socket, message)
Authorization can happen here
- #handle_leave(client_socket)
- #handle_message(client_socket, message)
-
#on_message(client_socket_id, message)
Called from proc when message is returned from the pubsub service
Constructor Detail
Instance Method Detail
def on_message(client_socket_id, message)
#
Called from proc when message is returned from the pubsub service