def receive_chunk
      Timeout.timeout(TIMEOUT, TimeoutError) do
        length, type = receive_header
        if length > 0
          content = socket.read(length)
        end

        handle_chunk(type, content)
      end
    end
def receive_chunk
      Timeout.timeout(TIMEOUT, TimeoutError) do
        length, type = receive_header
        if length > 0
          content = socket.read(length)
        end

        handle_chunk(type, content)
      end
    end
Private: get the next chunk from the socket, and then determine what to do with it.