Class: Wamp::Client::Transport::Base
- Inherits:
-
Object
- Object
- Wamp::Client::Transport::Base
- Includes:
- Event
- Defined in:
- lib/wamp/client/transport/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connected ⇒ Object
Returns the value of attribute connected.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
-
.add_tick_loop(&block) ⇒ Object
Method to add a tick loop to the event machine.
-
.add_timer(milliseconds, &callback) ⇒ Object
Process the callback when the timer expires.
-
.start_event_machine(&block) ⇒ Object
Method to start the event machine for the socket.
-
.stop_event_machine ⇒ Object
Method to stop the vent machine.
Instance Method Summary collapse
-
#add_timer(milliseconds, &callback) ⇒ Object
Implement in subclass.
-
#connect ⇒ Object
Connects to the WAMP Server using the transport.
-
#connected? ⇒ Boolean
Returns true if the transport it connected.
-
#disconnect ⇒ Object
Disconnects from the WAMP Server.
-
#initialize(options) ⇒ Base
constructor
Constructor for the transport.
-
#send_message(msg) ⇒ Object
Sends a Message.
Methods included from Event
Constructor Details
#initialize(options) ⇒ Base
Constructor for the transport
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/wamp/client/transport/base.rb', line 21 def initialize() # Initialize the parameters self.connected = false self.uri = [:uri] self.proxy = [:proxy] self.headers = [:headers] || {} self.protocol = [:protocol] || 'wamp.2.json' self.serializer = [:serializer] || Wamp::Client::Serializer::JSONSerializer.new # Add the wamp.2.json protocol header self.headers['Sec-WebSocket-Protocol'] = self.protocol end |
Instance Attribute Details
#connected ⇒ Object
Returns the value of attribute connected.
10 11 12 |
# File 'lib/wamp/client/transport/base.rb', line 10 def connected @connected end |
#headers ⇒ Object
Returns the value of attribute headers.
10 11 12 |
# File 'lib/wamp/client/transport/base.rb', line 10 def headers @headers end |
#protocol ⇒ Object
Returns the value of attribute protocol.
10 11 12 |
# File 'lib/wamp/client/transport/base.rb', line 10 def protocol @protocol end |
#proxy ⇒ Object
Returns the value of attribute proxy.
10 11 12 |
# File 'lib/wamp/client/transport/base.rb', line 10 def proxy @proxy end |
#serializer ⇒ Object
Returns the value of attribute serializer.
10 11 12 |
# File 'lib/wamp/client/transport/base.rb', line 10 def serializer @serializer end |
#uri ⇒ Object
Returns the value of attribute uri.
10 11 12 |
# File 'lib/wamp/client/transport/base.rb', line 10 def uri @uri end |
Class Method Details
.add_tick_loop(&block) ⇒ Object
Method to add a tick loop to the event machine
77 78 79 |
# File 'lib/wamp/client/transport/base.rb', line 77 def self.add_tick_loop(&block) # Implement in subclass end |
.add_timer(milliseconds, &callback) ⇒ Object
Process the callback when the timer expires
59 60 61 |
# File 'lib/wamp/client/transport/base.rb', line 59 def self.add_timer(milliseconds, &callback) # Implement in subclass end |
.start_event_machine(&block) ⇒ Object
Method to start the event machine for the socket
67 68 69 |
# File 'lib/wamp/client/transport/base.rb', line 67 def self.start_event_machine(&block) # Implement in subclass end |
.stop_event_machine ⇒ Object
Method to stop the vent machine
72 73 74 |
# File 'lib/wamp/client/transport/base.rb', line 72 def self.stop_event_machine # Implement in subclass end |
Instance Method Details
#add_timer(milliseconds, &callback) ⇒ Object
Implement in subclass
62 63 64 |
# File 'lib/wamp/client/transport/base.rb', line 62 def add_timer(milliseconds, &callback) self.class.add_timer(milliseconds, &callback) end |
#connect ⇒ Object
Connects to the WAMP Server using the transport
36 37 38 |
# File 'lib/wamp/client/transport/base.rb', line 36 def connect # Implement in subclass end |
#connected? ⇒ Boolean
Returns true if the transport it connected
46 47 48 |
# File 'lib/wamp/client/transport/base.rb', line 46 def connected? self.connected end |
#disconnect ⇒ Object
Disconnects from the WAMP Server
41 42 43 |
# File 'lib/wamp/client/transport/base.rb', line 41 def disconnect # Implement in subclass end |
#send_message(msg) ⇒ Object
Sends a Message
52 53 54 |
# File 'lib/wamp/client/transport/base.rb', line 52 def (msg) # Implement in subclass end |