Handle the SUBSCRIBE command: Adds this connection to destination.
763600
def subscribe(self, frame):
        
        ack = frame.headers.get('ack')
        reliable = ack and ack.lower() == 'client'

        self.engine.connection.reliable_subscriber = reliable

        dest = frame.headers.get('destination')
        if not dest:
            raise ProtocolError('Missing destination for SUBSCRIBE command.')

        if dest.startswith('/queue/'):
            self.engine.queue_manager.subscribe(self.engine.connection, dest)
        else:
            self.engine.topic_manager.subscribe(self.engine.connection, dest)
633235
def subscribe(self, stream_type, **parameters):
        """"""
        parameters["stream_type"] = stream_type

        if (stream_type == "result") and ("buffering" not in parameters):
            parameters["buffering"] = True

        self.socketIO.emit(self.EVENT_NAME_SUBSCRIBE, parameters)
1015971
protected void subscribe( String id, MessagingContext ctx ) throws IOException {

		if( ! canProceed())
			return;

		Set<MessagingContext> sub = this.routingContext.subscriptions.get( id );
		if( sub == null ) {
			sub = new HashSet<> ();
			this.routingContext.subscriptions.put( id, sub );
		}

		sub.add( ctx );
	}
1215997
function subscribe(subscriber, immediate) {
        if (!~subscribers.indexOf(subscriber)) {
            subscribers.push(subscriber);
        }
        if (immediate) {
            subscriber(value);
        }
    }
187143
function execute(req, res) {
  this.state.pubsub.punsubscribe(req.conn, req.args);
}
214389
def subscribe(self, event, handler):
        
        self._handlers.sync_handlers[event].append(handler)
836661
function subscribe(conn, channels) {
  return this.doSubscribe(
    PUBSUB.SUBSCRIBE,
    PUBSUB.CHANNELS,
    this._channels, conn, channels);
}
419568
def subscribe(self, topic, callback, qos):
        """"""
        if topic in self.topics:
            return

        def _message_callback(mqttc, userdata, msg):
            """Callback added to callback list for received message."""
            callback(msg.topic, msg.payload.decode('utf-8'), msg.qos)

        self._mqttc.subscribe(topic, qos)
        self._mqttc.message_callback_add(topic, _message_callback)
        self.topics[topic] = callback
67373
def _execute(self, sender, event_args):
        '''
        
        '''
        with self._lock:
            while not self._messages.empty():
                msg, args, kwargs = self._messages.get(False)
                for subscriber in self._subscribers[msg]:
                    try:
                        subscriber(*args, **kwargs)
                    except weakref.ReferenceError:
                        # Reference to handler is lost and it is OK to silence it
                        pass
645858
def create(self):
        
        self.logger.debug('Create subscription on server...')

        if not self.connection.connected:
            self.state = 'connection_pending'
            return

        data = {
            'command': 'subscribe',
            'identifier': self._identifier_string()
        }

        self.connection.send(data)
        self.state = 'pending'
1046054
def subscribe(ws):
    """"""
    while ws is not None:
        gevent.sleep(0.1)
        try:
            message = ws.receive()  # expect function name to subscribe to
            if message:
                stream.register(ws, message)
        except WebSocketError:
            ws = None
725145
def receive(self, content, **kwargs):
        
        self.connection_context = DjangoChannelConnectionContext(self.message)
        self.subscription_server = DjangoChannelSubscriptionServer(graphene_settings.SCHEMA)
        self.subscription_server.on_open(self.connection_context)
        self.subscription_server.handle(content, self.connection_context)
340602
def subscribe(self, obj, handler):
    """"""
    if not isinstance(obj, LutronEntity):
      raise InvalidSubscription("Subscription target not a LutronEntity")
    _LOGGER.warning("DEPRECATED: Subscribing via Lutron.subscribe is obsolete. "
                    "Please use LutronEntity.subscribe")
    if obj not in self._legacy_subscribers:
      self._legacy_subscribers[obj] = handler
      obj.subscribe(self._dispatch_legacy_subscriber, None)
160681
protected void doSubscribe(javax.servlet.sip.SipServletRequest req) throws javax.servlet.ServletException, java.io.IOException{
    	if (req.isInitial())
			notImplemented(req);
    }
690570
def command_subscribe(self, command, **kwargs):
        
        topic = command['topic']
        encoding = command.get('encoding', 'utf-8')
        name = command['name']
        if not hasattr(self.engine, '_mqtt'):
            self.engine._mqtt = {}
        self.engine.variables[name] = []

        def on_message(client, userdata, msg):
            userdata.append(msg.payload.decode(encoding))
        self.engine._mqtt[name] = client = mqtt.Client(
            userdata=self.engine.variables[name])
        client.on_message = on_message
        client.connect(
            command['host'],
            port=int(command['port'])
        )
        client.subscribe(topic)
        client.loop_start()
        self.engine.register_teardown_callback(
            client.loop_stop)
936545
def send(self, command, message=None):
        ''''''
        if message:
            joined = command + constants.NL + util.pack(message)
        else:
            joined = command + constants.NL
        if self._blocking:
            for sock in self.socket():
                sock.sendall(joined)
        else:
            self._pending.append(joined)
836269
def subscribe(self, socket_id, channel):
        """"""
        con = self._get_connection(socket_id)
        self.subscriptions.setdefault(channel, set()).add(socket_id)
        con.subscriptions.add(channel)