Channels
Introduction
Example Usage
class ChatRoomChannel < Maze::Websockets::Channel
# optional
# Authorization can happen here
def handle_joined(client_socket, message)
# channel join related functionality
# if client_socket.session[:user_id] != message["payload"]["user_id"]
# client_socket.disconnect!
# end
end
# required
def handle_message(client_socket, msg)
rebroadcast!(msg)
end
# optional
def handle_leave(client_socket)
# channel leave functionality
end
endLast updated