Class: Wamp::Client::Connection
- Inherits:
- 
      Object
      
        - Object
- Wamp::Client::Connection
 
- Includes:
- Event
- Defined in:
- lib/wamp/client/connection.rb
Instance Attribute Summary collapse
- 
  
    
      #options  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute options. 
- 
  
    
      #session  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute session. 
- 
  
    
      #transport  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute transport. 
- 
  
    
      #transport_class  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute transport_class. 
Instance Method Summary collapse
- 
  
    
      #close  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Closes the connection. 
- 
  
    
      #initialize(options)  ⇒ Connection 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Connection. 
- 
  
    
      #is_open?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns true if the connection is open. 
- 
  
    
      #open  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Opens the connection. 
Methods included from Event
Constructor Details
#initialize(options) ⇒ Connection
Returns a new instance of Connection.
| 24 25 26 27 28 29 30 31 32 | # File 'lib/wamp/client/connection.rb', line 24 def initialize() self.transport_class = .delete(:transport) || Wamp::Client::Transport::WebSocketEventMachine self. = || {} @reconnect = true @open = false logger.info("#{self.class.name} using version #{Wamp::Client::VERSION}") end | 
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
| 11 12 13 | # File 'lib/wamp/client/connection.rb', line 11 def @options end | 
#session ⇒ Object
Returns the value of attribute session.
| 11 12 13 | # File 'lib/wamp/client/connection.rb', line 11 def session @session end | 
#transport ⇒ Object
Returns the value of attribute transport.
| 11 12 13 | # File 'lib/wamp/client/connection.rb', line 11 def transport @transport end | 
#transport_class ⇒ Object
Returns the value of attribute transport_class.
| 11 12 13 | # File 'lib/wamp/client/connection.rb', line 11 def transport_class @transport_class end | 
Instance Method Details
#close ⇒ Object
Closes the connection
| 51 52 53 54 55 56 57 58 59 60 | # File 'lib/wamp/client/connection.rb', line 51 def close raise RuntimeError, 'connection is already closed' unless self.is_open? # Leave the session @reconnect = false @retrying = false session.leave end | 
#is_open? ⇒ Boolean
Returns true if the connection is open
| 64 65 66 | # File 'lib/wamp/client/connection.rb', line 64 def is_open? @open end | 
#open ⇒ Object
Opens the connection
| 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # File 'lib/wamp/client/connection.rb', line 35 def open raise RuntimeError, 'connection is already open' if self.is_open? @reconnect = true @retry_timer = 1 @retrying = false self.transport_class.start_event_machine do # Create the transport create_transport end end |