Class: Wamp::Manager::Event::Hello
- Inherits:
-
Base
- Object
- SimpleDelegator
- Base
- Wamp::Manager::Event::Hello
show all
- Defined in:
- lib/wamp/manager/event/hello.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#session
Instance Method Summary
collapse
Methods inherited from Base
#emit_event_name, #error?, #initialize, #transmit
Instance Method Details
#add_event_listener ⇒ Object
11
12
13
|
# File 'lib/wamp/manager/event/hello.rb', line 11
def add_event_listener
session.transmit(payload)
end
|
#emit_event(hello) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/wamp/manager/event/hello.rb', line 15
def emit_event(hello)
session.emit(:authenticate, hello)
auth_session = Wamp::Router::Session::Base.new(hello)
message = update_session_id_and_return(auth_session.handle_auth)
session.transmit(message.payload)
session.on(:authenticate) do |authenticate|
welcome_or_error = update_session_id_and_return(auth_session.authenticate(authenticate))
session.transmit(welcome_or_error.payload)
end
end
|
#listen_event_name ⇒ Object
32
33
34
|
# File 'lib/wamp/manager/event/hello.rb', line 32
def listen_event_name
:join
end
|
#update_session_id_and_return(message) ⇒ Object
27
28
29
30
|
# File 'lib/wamp/manager/event/hello.rb', line 27
def update_session_id_and_return(message)
session.session_id = message.session_id if message.respond_to?(:session_id)
message
end
|