someone is listening, start subscribing
501059
function listenerFn(msgObj) {
      channel._addEL[msgObj.type].forEach(function (obj) {
        if (msgObj.time >= obj.time) {
          obj.fn(msgObj.data);
        }
      });
    }
360179
def accept_subscription(&blk)
      pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribed')
      connection.send_stanza pres, &blk
    end
269780
def sub(self, topic, channel):
        ''''''
        return self.send(' '.join((constants.SUB, topic, channel)))
3064
def subscribe(self, receiver):
        ""
        log.debug('{0}.{1} subscribe to {2}'
                  .format(receiver.__module__, receiver.__name__, self))
        self.signal.connect(receiver)
819317
def incoming(message, callback)
      if message['channel'] == '/meta/subscribe'
        authenticate_subscribe(message)
      elsif message['channel'] !~ %r{^/meta/}
        authenticate_publish(message)
      end
      callback.call(message)
    end
474263
def listen(self):
        
        for message in self.pubsub.listen():
            if message['type'] == 'message':
                message_type, client_id, client_storage, args, kwargs = self.unpack(
                    message['data'])

                self.dispatch_message(
                    message_type, client_id, client_storage, args, kwargs)
114410
function subscribe(pattern, object) {
    var paths = pattern.split('.');
    var path;
    var regex = [];

    for (var i = 0, l = paths.length; i < l; i++) {
      path = paths[i];
      if (path === '*') {
        regex.push('[^\\.]*');
      } else {
        regex.push(path);
      }
    }

    regex = regex.join('\\.');
    regex = regex + '(\\..*)?';

    var subscriber = {
      pattern: pattern,
      regex: new RegExp('^' + regex + '$'),
      object: object
    };

    subscribers.push(subscriber);
    cache = {};

    return subscriber;
  }
1027291
def start_subscribe(self):
        """"""
        if not self.conn:
            raise ValueError('Not connected')
        elif not self.pubsub_conn:
            raise ValueError('PubSub not enabled')

        # creates a new context manager
        return Subscription(self)
349238
def start(self):
        """"""
        super(ResourceValues, self).start()
        self._api.ensure_notifications_thread()
        self._presubs.add(self._sdk_presub_params)
        if self._immediacy == FirstValue.on_value_update:
            self._subscribe_all_matching()
64989
def register(self, subscriber):
        
        assert isinstance(subscriber, RequestHandler)
        logger.debug('New subscriber')
        self.subscribers.add(subscriber)
618250
function subscribe(message) {
		reply(proto.writeSubscribe(message.id));
		subscritions[message.itemName] = message.id;
		if (!isSnapshotAvailable(message.itemName)) {
			notify(proto.writeEndOfSnapshot(message.id, message.itemName));
		}
		dequeueSubUnsubRequest(message.itemName);
		fireFirstSubUnsubEvent(message.itemName);
	}
1322844
def subscribe(self, topic, qos):
        """"""
        if self.sock == NC.INVALID_SOCKET:
            return NC.ERR_NO_CONN
        
        self.logger.info("SUBSCRIBE: %s", topic)
        return self.send_subscribe(False, [(utf8encode(topic), qos)])
245867
def subscribe(*args, &block)
      @mutex.synchronize do
        listener = Listener.new(*args)
        listener.on_delivery(&block)
        @listeners << listener
      end
    end
951937
function (event) {
    this.debug("Requesting subscription for " + event);
    sendReceive.call(this, {'do': 'subscribe', params: [event]}, function (result) {
        if (result.success) {
            this.debug("Succesfully subscribed to %s", event);
        } else {
            this.debug("Subscription request for %s failed", event);
        }
    });
    this.subscribedEvents.push(event);
}
1065214
@Override
    @CallerSideMethod public void subscribe(Subscriber subs) {
        // need callerside to transform to Callback
        Callback callback = (r, e) -> {
            if (Actors.isResult(e))
                subs.getReceiver().receive((ChangeMessage) r);
        };
        _subscribe(subs.getFilter(), callback, subs.getId());
    }
448041
function subscribeToChat () {
  console.tron.log('Subscribing to Chat')
  if (!subscriptions.hasOwnProperty('chat')) {
    subscriptions.chat = { subscribed: true }
    connection.then(() => {
      chatSubscriber = stompClient.subscribe('/topic/chat', onMessage.bind(this, 'chat'))
    })
  }
}
445061
def _handle_subscription(self, topics):
        """"""
        if not isinstance(topics, list):
            topics = [topics]
        for topic in topics:
            topic_levels = topic.split('/')
            try:
                qos = int(topic_levels[-2])
            except ValueError:
                qos = 0
            try:
                _LOGGER.debug('Subscribing to: %s, qos: %s', topic, qos)
                self._sub_callback(topic, self.recv, qos)
            except Exception as exception:  # pylint: disable=broad-except
                _LOGGER.exception(
                    'Subscribe to %s failed: %s', topic, exception)