def actual_send(type, time, id, data)
      # Namespace support!
      prefix = "#{@namespace}_" unless @namespace.nil?
      # Get rid of any unwanted characters, and replace each of them with an _.
      type = type.to_s.gsub RESERVED_CHARS_REGEX, '_'

      # Start constructing the message to be sent to Cube over UDP.
      message = {
        type: "#{prefix}#{type}"
      }
      message[:time] = time.iso8601 unless time.nil?
      message[:id] = id unless id.nil?
      message[:data] = data unless data.nil?

      # JSONify it, log it, and send it off.
      message_str = message.to_json
      self.class.logger.debug { "Cube: #{message_str}" } if self.class.logger

      socket.send message_str, 0, @host, @port
    rescue => err
      self.class.logger.error { "Cube: #{err.class} #{err}" } if self.class.logger
    end
def actual_send(type, time, id, data)
      # Namespace support!
      prefix = "#{@namespace}_" unless @namespace.nil?
      # Get rid of any unwanted characters, and replace each of them with an _.
      type = type.to_s.gsub RESERVED_CHARS_REGEX, '_'

      # Start constructing the message to be sent to Cube over UDP.
      message = {
        type: "#{prefix}#{type}"
      }
      message[:time] = time.iso8601 unless time.nil?
      message[:id] = id unless id.nil?
      message[:data] = data unless data.nil?

      # JSONify it, log it, and send it off.
      message_str = message.to_json
      self.class.logger.debug { "Cube: #{message_str}" } if self.class.logger

      socket.send message_str, 0, @host, @port
    rescue => err
      self.class.logger.error { "Cube: #{err.class} #{err}" } if self.class.logger
    end
Actually send the given data to a socket, and potentially log it along
 the way.

 @param [String] The desired name of the new Cube event.
 @param [DateTime] Optional. A specific time when the Cube event occurred.
 @param [Object] Optional. Typically an integer, but can be any object.
 @param [Hash] Optional. Anything in this hash will be stored in the
   `data` subdocument of the Cube event.