Subscribe a client to the channel.
355074
def subscribe(self, client):
        """"""
        self.clients.append(client)
        log("Subscribed client {} to channel {}".format(client, self.name))
941322
def subscribe(self, id, name, port):
		""""""
		sub = gntp.core.GNTPSubscribe()
		sub.add_header('Subscriber-ID', id)
		sub.add_header('Subscriber-Name', name)
		sub.add_header('Subscriber-Port', port)
		if self.password:
			sub.set_password(self.password, self.passwordHash)

		self.add_origin_info(sub)
		self.subscribe_hook(sub)

		return self._send('subscribe', sub)
880843
def subscribe_parameter(param, &callback)
      sub = ParameterSubscriber.new(param, callback)
      @manager.add_parameter_subscriber(sub)
      sub
    end
1225804
@Override
	public Promise subscribe(String channel) {
		try {

			// Create topic
			ProjectTopicName topicName = ProjectTopicName.of(projectID, channel);
			Topic topic = null;
			try {
				topic = topicAdmin.getTopic(topicName);
			} catch (NotFoundException notFound) {
			}
			if (topic == null) {
				topic = topicAdmin.createTopic(topicName);
				logger.info("Topic \"" + topic.getName() + "\" created successfully.");
			}

			// Create subscription
			String nodeSubscription;
			if (channel.endsWith('.' + nodeID)) {
				nodeSubscription = channel;
			} else {
				nodeSubscription = channel + '-' + nodeID;
			}
			ProjectSubscriptionName subscriptionName = ProjectSubscriptionName.of(projectID, nodeSubscription);
			Subscription subscription = null;
			try {
				subscription = subscriptionAdmin.getSubscription(subscriptionName);
			} catch (NotFoundException notFound) {
			}
			if (subscription == null) {
				subscription = subscriptionAdmin.createSubscription(subscriptionName, topicName,
						PushConfig.getDefaultInstance(), ackDeadlineSeconds);
				logger.info("Subscription \"" + subscription.getName() + "\" created successfully.");
			}

			// Create subscriber
			synchronized (subscribers) {
				if (!subscribers.containsKey(nodeSubscription)) {
					Subscriber.Builder builder = Subscriber.newBuilder(subscriptionName, (message, consumer) -> {

						// Message received
						try {

							// We are running in a netty executor's pool,
							// do not create new task.
							processReceivedMessage(channel, message.getData().toByteArray());
						} finally {
							consumer.ack();
						}

					});
					if (channelProvider != null) {
						builder.setChannelProvider(channelProvider);
					}
					if (credentialsProvider != null) {
						builder.setCredentialsProvider(credentialsProvider);
					}
					if (executorProvider != null) {
						builder.setExecutorProvider(executorProvider);
						builder.setSystemExecutorProvider(executorProvider);
					} else {
						builder.setExecutorProvider(defaultExecutorProvider);
						builder.setSystemExecutorProvider(defaultExecutorProvider);
					}
					if (headerProvider != null) {
						builder.setHeaderProvider(headerProvider);
					}
					if (maxAckExtensionPeriod != null) {
						builder.setMaxAckExtensionPeriod(maxAckExtensionPeriod);
					}
					if (parallelPullCount > 0) {
						builder.setParallelPullCount(parallelPullCount);
					}
					if (flowControlSettings != null) {
						builder.setFlowControlSettings(flowControlSettings);
					}
					Subscriber subscriber = builder.build();
					subscriber.startAsync();
					subscribers.put(nodeSubscription, subscriber);
					logger.info(
							"Subscriber created for subscription \"" + subscriber.getSubscriptionNameString() + "\".");
				}
			}

		} catch (Exception cause) {
			return Promise.reject(cause);
		}
		return Promise.resolve();
	}
1164760
def on_connect(self, connection):
        ""
        # NOTE: for python3, we can't pass bytestrings as keyword arguments
        # so we need to decode channel/pattern names back to unicode strings
        # before passing them to [p]subscribe.
        self.pending_unsubscribe_channels.clear()
        self.pending_unsubscribe_patterns.clear()
        if self.channels:
            channels = {}
            for k, v in iteritems(self.channels):
                channels[self.encoder.decode(k, force=True)] = v
            self.subscribe(**channels)
        if self.patterns:
            patterns = {}
            for k, v in iteritems(self.patterns):
                patterns[self.encoder.decode(k, force=True)] = v
            self.psubscribe(**patterns)
866306
def subscribe(self, name, params=[], callback=None):
        """"""
        self._wait_for_connect()

        def subscribed(error, sub_id):
            if error:
                self._remove_sub_by_id(sub_id)
                if callback:
                    callback(error.get('reason'))
                return
            if callback:
                callback(None)
            self.emit('subscribed', name)

        if name in self.subscriptions:
            raise MeteorClientException('Already subcribed to {}'.format(name))

        sub_id = self.ddp_client.subscribe(name, params, subscribed)
        self.subscriptions[name] = {
            'id': sub_id,
            'params': params
        }
670984
function psubscribe(conn, channels) {
  return this.doSubscribe(
    PUBSUB.PSUBSCRIBE,
    PUBSUB.PATTERNS,
    this._patterns, conn, channels);
}
79961
def broadcast(msg, *args)
      subscribers.each do |subscr|
        next unless subscr.respond_to?(msg) || subscr.respond_to?(:accept_all)

        subscr.send(msg, *args)
      end
    end
1111008
def subscribe(self, subscription):
        """"""
        url = urljoin(self._url, '/subscriptions')
        return subscription.post(url)
1011493
def subscribe(self, channel_name):
        
        data = {'channel': channel_name}

        if channel_name.startswith('presence-'):
            data['auth'] = self._generate_presence_key(
                self.connection.socket_id,
                self.key,
                channel_name,
                self.secret,
                self.user_data
            )
            data['channel_data'] = json.dumps(self.user_data)
        elif channel_name.startswith('private-'):
            data['auth'] = self._generate_private_key(
                self.connection.socket_id,
                self.key,
                channel_name,
                self.secret
            )

        self.connection.send_event('pusher:subscribe', data)

        self.channels[channel_name] = Channel(channel_name, self.connection)

        return self.channels[channel_name]
884854
@Override
	public Promise subscribe(String channel) {
		try {

			// Create publisher
			createOrGetPublisher(channel);

			// Create subscriber
			synchronized (subscribers) {
				if (!subscribers.containsKey(channel)) {
					TopicSubscriber subscriber = session.createSubscriber(session.createTopic(channel));
					subscribers.put(channel, subscriber);
					subscriber.setMessageListener((message) -> {
						try {
							BytesMessage msg = (BytesMessage) message;
							byte[] bytes = new byte[(int) msg.getBodyLength()];
							msg.readBytes(bytes);
							received(channel, bytes);
						} catch (Exception cause) {
							logger.error("Unable to deserialize message!", cause);
						}
					});
				}
			}
		} catch (Exception cause) {
			return Promise.reject(cause);
		}
		return Promise.resolve();
	}
552757
def _bind_channels(self, events, channels):
        
        for channel_name in channels:
            if channel_name in self.channels:
                channel = self.pusher.subscribe(channel_name)
                if isinstance(events, list):
                    for event in events:
                        channel.bind(event, channels[channel_name])
                else:
                    channel.bind(events, channels[channel_name])
635818
def subscribe(topic, protocol, endpoint, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    conn.subscribe(get_arn(topic, region, key, keyid, profile), protocol, endpoint)
    log.info('Subscribe %s %s to %s topic', protocol, endpoint, topic)
    try:
        del __context__[_subscriptions_cache_key(topic)]
    except KeyError:
        pass
    return True
269780
def sub(self, topic, channel):
        ''''''
        return self.send(' '.join((constants.SUB, topic, channel)))
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)
856781
def subscribe(topic_name, topic_type, &callback)
      sub = Subscriber.new(@node_name,
                           resolve_name(topic_name),
                           topic_type,
                           callback)
      @manager.add_subscriber(sub)
      trap_signals
      sub
    end
1139008
function subscribe (channels) {
    channels.forEach(channel => {
      if (~_subscribedChannels.indexOf(channel)) return
      _subscribedChannels.push(channel)
      if (_socket) _socket.subscribe(channel)
    })
    return connection
  }