Class: Runivedo::Connection
- Inherits:
-
Object
- Object
- Runivedo::Connection
- Defined in:
- lib/runivedo/connection.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #get_session(bucket, auth) ⇒ Object
-
#initialize(url) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(url) ⇒ Connection
Returns a new instance of Connection.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/runivedo/connection.rb', line 23 def initialize(url) @remote_objects = {} @ws = RfcWebSocket::WebSocket.new(url) # Use TCP_NODELAY, since usually SQL queries are pretty small packets. @ws.instance_variable_get(:@socket).setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) Thread.new { handle_ws } @urologin = RemoteObject.new(self, 0) @remote_objects[0] = @urologin end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
21 22 23 |
# File 'lib/runivedo/connection.rb', line 21 def error @error end |
Instance Method Details
#close ⇒ Object
38 39 40 41 |
# File 'lib/runivedo/connection.rb', line 38 def close @ws.close close_ros(Runivedo::ConnectionError.new("connection closed")) end |
#closed? ⇒ Boolean
43 44 45 |
# File 'lib/runivedo/connection.rb', line 43 def closed? @ws.closed? end |
#get_session(bucket, auth) ⇒ Object
34 35 36 |
# File 'lib/runivedo/connection.rb', line 34 def get_session(bucket, auth) @urologin.call_rom('getSession', bucket, auth) end |