Sha256: 5d6db0b9aedc82db98e30967716220e07cb99883d8946bd8f87280dcef2d691c
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true require_relative "realm" module Wamp module Router # Router class Base attr_reader :realms def initialize @realms = {} end def add_realm(name) realms[name] = Realm.new(name) end def remove_realm(name) realms.delete(name) end def attach_client(client) error_message = "cannot attach client to non-existent realm #{client.realm}" raise Wampproto::ValueError, error_message unless realms.include?(client.realm) realms[client.realm].attach_client(client) end def detach_client(client) error_message = "cannot attach client to non-existent realm #{client.realm}" raise Wampproto::ValueError, error_message unless realms.include?(client.realm) realms[client.realm].detach_client(client) end def receive_message(client, message) error_message = "cannot attach client to non-existent realm #{client.realm}" raise Wampproto::ValueError, error_message unless realms.include?(client.realm) realms[client.realm].receive_message(client.session_id, message) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xconn-0.1.2 | lib/wamp/router/base.rb |
xconn-0.1.1 | lib/wamp/router/base.rb |
xconn-0.1.0 | lib/wamp/router/base.rb |