Class: WampClient::Transport::Base
- Inherits:
- 
      Object
      
        - Object
- WampClient::Transport::Base
 
- Defined in:
- lib/wamp_client/transport.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. 
- 
  
    
      #serializer  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute serializer. 
- 
  
    
      #type  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute type. 
- 
  
    
      #uri  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute uri. 
Instance Method Summary collapse
- 
  
    
      #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. 
- #on_close(&on_close) ⇒ Object
- #on_error(&on_error) ⇒ Object
- #on_message(&on_message) ⇒ Object
- #on_open(&on_open) ⇒ Object
- 
  
    
      #send_message(msg)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Sends a Message. 
- 
  
    
      #timer(milliseconds, &callback)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Process the callback when the timer expires. 
Constructor Details
#initialize(options) ⇒ Base
Constructor for the transport
| 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | # File 'lib/wamp_client/transport.rb', line 68 def initialize() # Initialize the parameters self.connected = false self.uri = [:uri] self.headers = [:headers] || {} self.protocol = [:protocol] || 'wamp.2.json' self.serializer = [:serializer] || WampClient::Serializer::JSONSerializer.new # Add the wamp.2.json protocol header self.headers['Sec-WebSocket-Protocol'] = self.protocol # Initialize callbacks @on_open = nil @on_close = nil @on_message = nil @on_error = nil end | 
Instance Attribute Details
#connected ⇒ Object
Returns the value of attribute connected.
| 60 61 62 | # File 'lib/wamp_client/transport.rb', line 60 def connected @connected end | 
#headers ⇒ Object
Returns the value of attribute headers.
| 60 61 62 | # File 'lib/wamp_client/transport.rb', line 60 def headers @headers end | 
#protocol ⇒ Object
Returns the value of attribute protocol.
| 60 61 62 | # File 'lib/wamp_client/transport.rb', line 60 def protocol @protocol end | 
#serializer ⇒ Object
Returns the value of attribute serializer.
| 60 61 62 | # File 'lib/wamp_client/transport.rb', line 60 def serializer @serializer end | 
#type ⇒ Object
Returns the value of attribute type.
| 60 61 62 | # File 'lib/wamp_client/transport.rb', line 60 def type @type end | 
#uri ⇒ Object
Returns the value of attribute uri.
| 60 61 62 | # File 'lib/wamp_client/transport.rb', line 60 def uri @uri end | 
Instance Method Details
#connect ⇒ Object
Connects to the WAMP Server using the transport
| 89 90 91 | # File 'lib/wamp_client/transport.rb', line 89 def connect # Implement in subclass end | 
#connected? ⇒ Boolean
Returns true if the transport it connected
| 99 100 101 | # File 'lib/wamp_client/transport.rb', line 99 def connected? self.connected end | 
#disconnect ⇒ Object
Disconnects from the WAMP Server
| 94 95 96 | # File 'lib/wamp_client/transport.rb', line 94 def disconnect # Implement in subclass end | 
#on_close(&on_close) ⇒ Object
| 43 44 45 | # File 'lib/wamp_client/transport.rb', line 43 def on_close(&on_close) @on_close = on_close end | 
#on_error(&on_error) ⇒ Object
| 56 57 58 | # File 'lib/wamp_client/transport.rb', line 56 def on_error(&on_error) @on_error = on_error end | 
#on_message(&on_message) ⇒ Object
| 50 51 52 | # File 'lib/wamp_client/transport.rb', line 50 def (&) @on_message = end | 
#on_open(&on_open) ⇒ Object
| 36 37 38 | # File 'lib/wamp_client/transport.rb', line 36 def on_open(&on_open) @on_open = on_open end | 
#send_message(msg) ⇒ Object
Sends a Message
| 105 106 107 | # File 'lib/wamp_client/transport.rb', line 105 def (msg) # Implement in subclass end | 
#timer(milliseconds, &callback) ⇒ Object
Process the callback when the timer expires
| 112 113 114 | # File 'lib/wamp_client/transport.rb', line 112 def timer(milliseconds, &callback) # Implement in subclass end |