def send_message(msg, type = 'TextMessage')
      connect do |http|
        request = http_request(:post, "/room/#{room_id}/speak.json")
        request.body = { :message => { :body => msg, :type => type } }.to_json
        response = http.request(request)

        case response
        when Net::HTTPCreated
          true
        else
          raise ConnectionError,
            "Error sending message '#{msg}' (#{response.class})"
        end
      end
    end
def send_message(msg, type = 'TextMessage')
      connect do |http|
        request = http_request(:post, "/room/#{room_id}/speak.json")
        request.body = { :message => { :body => msg, :type => type } }.to_json
        response = http.request(request)

        case response
        when Net::HTTPCreated
          true
        else
          raise ConnectionError,
            "Error sending message '#{msg}' (#{response.class})"
        end
      end
    end
Internal: Posts a message to the campfire room.

 msg   - The String message to send.
 type  - The String type of campfire message (default: TextMessage).

 Returns true if message is delivered.
 Raises ConnectionError if an HTTP error occurs.