Class: Wamp::Connection::Session
- Inherits:
-
Object
- Object
- Wamp::Connection::Session
- Defined in:
- lib/wamp/connection/session.rb
Overview
Client Session
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#executor ⇒ Object
Returns the value of attribute executor.
-
#joiner ⇒ Object
readonly
Returns the value of attribute joiner.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#store ⇒ Object
readonly
Returns the value of attribute store.
-
#stream ⇒ Object
Returns the value of attribute stream.
Instance Method Summary collapse
-
#initialize(joiner = Wampproto::Joiner.new("realm1")) ⇒ Session
constructor
A new instance of Session.
- #on_join(&block) ⇒ Object
- #on_message(data) ⇒ Object
- #on_open ⇒ Object
- #transmit(data) ⇒ Object
Constructor Details
#initialize(joiner = Wampproto::Joiner.new("realm1")) ⇒ Session
Returns a new instance of Session.
10 11 12 13 14 15 |
# File 'lib/wamp/connection/session.rb', line 10 def initialize(joiner = Wampproto::Joiner.new("realm1")) @joiner = joiner @session = Wampproto::Session.new(joiner.serializer) @api = MessageHandler::Api.new(self) @store = {} end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
7 8 9 |
# File 'lib/wamp/connection/session.rb', line 7 def api @api end |
#executor ⇒ Object
Returns the value of attribute executor.
8 9 10 |
# File 'lib/wamp/connection/session.rb', line 8 def executor @executor end |
#joiner ⇒ Object (readonly)
Returns the value of attribute joiner.
7 8 9 |
# File 'lib/wamp/connection/session.rb', line 7 def joiner @joiner end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
7 8 9 |
# File 'lib/wamp/connection/session.rb', line 7 def session @session end |
#store ⇒ Object (readonly)
Returns the value of attribute store.
7 8 9 |
# File 'lib/wamp/connection/session.rb', line 7 def store @store end |
#stream ⇒ Object
Returns the value of attribute stream.
8 9 10 |
# File 'lib/wamp/connection/session.rb', line 8 def stream @stream end |
Instance Method Details
#on_join(&block) ⇒ Object
17 18 19 |
# File 'lib/wamp/connection/session.rb', line 17 def on_join(&block) self.executor = block end |
#on_message(data) ⇒ Object
25 26 27 28 |
# File 'lib/wamp/connection/session.rb', line 25 def (data) handler = MessageHandler.resolve(data, self) handler.handle end |
#on_open ⇒ Object
21 22 23 |
# File 'lib/wamp/connection/session.rb', line 21 def on_open stream. joiner.send_hello end |
#transmit(data) ⇒ Object
30 31 32 |
# File 'lib/wamp/connection/session.rb', line 30 def transmit(data) stream. data end |