def send_message(type, message=nil)
      message = message.nil? ? message = '' : message.to_json
      body = type + ' ' + message
      body.strip!
      length = body.bytesize
      @client.write("#{length}\n#{body}")
    end
def send_message(type, message=nil)
      message = message.nil? ? message = '' : message.to_json
      body = type + ' ' + message
      body.strip!
      length = body.bytesize
      @client.write("#{length}\n#{body}")
    end
Sends a message of a specific type