def send_message(message, options = {})
      url = URI.join(@stream_connection.control_address, '/lightstreamer/send_message.txt').to_s

      query = { LS_session: session_id, LS_message: message }
      query[:LS_sequence] = options.fetch(:sequence) if options[:async]
      query[:LS_msg_prog] = options.fetch(:number) if options[:async]
      query[:LS_max_wait] = options[:max_wait] if options[:max_wait]

      PostRequest.execute url, query
    end
def send_message(message, options = {})
      url = URI.join(@stream_connection.control_address, '/lightstreamer/send_message.txt').to_s

      query = { LS_session: session_id, LS_message: message }
      query[:LS_sequence] = options.fetch(:sequence) if options[:async]
      query[:LS_msg_prog] = options.fetch(:number) if options[:async]
      query[:LS_max_wait] = options[:max_wait] if options[:max_wait]

      PostRequest.execute url, query
    end
Sends a custom message to the Lightstreamer server. Message sending can be done synchronously or asynchronously.
 By default the message will be sent synchronously, i.e. the message will be processed by the server and if an
 error occurs a {LightstreamerError} subclass will be raised immediately. However, if the `:async` option is true
 then the message will be sent asynchronously, and the result of the message send will be reported to all callbacks
 that have been registered via {#on_message_result}. If `:async` is set to `true` then the `:sequence` and
 `:number` options must also be specified.

 @param [String] message The message to send to the Lightstreamer server.
 @param [Hash] options The options that control messages sent asynchronously.
 @option options [Boolean] :async Whether to send the message asynchronously. Defaults to `false`.
 @option options [String] :sequence The alphanumeric identifier that identifies a subset of messages that are to
                 be processed in sequence based on the `:number` given to them. If the special
                 `"UNORDERED_MESSAGES"` sequence is used then the associated messages are processed immediately,
                 possibly concurrently, with no ordering constraint.
 @option options [Fixnum] :number The progressive number of this message within its sequence. Should start at 1.
 @option options [Float] :max_wait The maximum time the server can wait before processing this message if one or
                 more of the preceding messages in the same sequence have not been received. If not specified then
                 a timeout is assigned by the server.