Class: Lightstreamer::ControlConnection
- Inherits:
-
Object
- Object
- Lightstreamer::ControlConnection
- Defined in:
- lib/lightstreamer/control_connection.rb
Overview
Helper class used by Session and is responsible for sending Lightstreamer control requests.
Instance Method Summary collapse
-
#execute(operation, options = {}) ⇒ Object
Sends a Lightstreamer control request that executes the specified operation with the specified options.
-
#initialize(session_id, control_url) ⇒ ControlConnection
constructor
Initializes this class for sending Lightstreamer control requests using the specified session ID and control address.
-
#subscription_execute(operation, table, options = {}) ⇒ Object
Sends a Lightstreamer subscription control request with the specified operation, table, and options.
Constructor Details
#initialize(session_id, control_url) ⇒ ControlConnection
Initializes this class for sending Lightstreamer control requests using the specified session ID and control address.
11 12 13 14 |
# File 'lib/lightstreamer/control_connection.rb', line 11 def initialize(session_id, control_url) @session_id = session_id @control_url = URI.join(control_url, '/lightstreamer/control.txt').to_s end |
Instance Method Details
#execute(operation, options = {}) ⇒ Object
Sends a Lightstreamer control request that executes the specified operation with the specified options. If an error occurs then a LightstreamerError subclass will be raised.
21 22 23 24 25 26 |
# File 'lib/lightstreamer/control_connection.rb', line 21 def execute(operation, = {}) result = execute_post_request build_payload(operation, ) raise Errors::SyncError if result.first == 'SYNC ERROR' raise LightstreamerError.build(result[2], result[1]) if result.first != 'OK' end |
#subscription_execute(operation, table, options = {}) ⇒ Object
Sends a Lightstreamer subscription control request with the specified operation, table, and options. If an error occurs then a LightstreamerError subclass will be raised.
34 35 36 37 38 39 40 |
# File 'lib/lightstreamer/control_connection.rb', line 34 def subscription_execute(operation, table, = {}) [:table] = table operation, execute operation, end |