def subscribe(name, headers = {}, subId = nil)
raise Stomp::Error::NoCurrentConnection if closed?
headers = headers.symbolize_keys
headers[:destination] = name
if @protocol >= Stomp::SPL_11
raise Stomp::Error::SubscriptionRequiredError if (headers[:id].nil? && subId.nil?)
headers[:id] = subId if headers[:id].nil?
end
_headerCheck(headers)
if @logger && @logger.respond_to?(:on_subscribe)
@logger.on_subscribe(log_params, headers)
end
if @reliable
subId = name if subId.nil?
raise Stomp::Error::DuplicateSubscription if @subscriptions[subId]
@subscriptions[subId] = headers
end
transmit(Stomp::CMD_SUBSCRIBE, headers)
end