Subscribing to one event only

@param channel
@param subscription
@param context
550606
function (channel, subscription, context) {
      Backbone.Mediator.subscribe(channel, subscription, context, true);
    }
336336
def context_notify_cb(self, context, _):
        
        state = pa_context_get_state(context)

        if state == PA_CONTEXT_READY:
            pa_operation_unref(
                pa_context_get_server_info(context, self._server_info_cb, None))

            pa_context_set_subscribe_callback(context, self._update_cb, None)

            pa_operation_unref(pa_context_subscribe(
                context, PA_SUBSCRIPTION_EVENT_CHANGE | PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SERVER, self._success_cb, None))
964600
@Override
    protected boolean reSubscribe(EventChannelStruct event_channel_struct,
                                  EventCallBackStruct callback_struct) {
        boolean retVal = true;

        try {
            DeviceData subscriber_in = new DeviceData();
            String[] subscriber_info = new String[4];
            subscriber_info[0] = callback_struct.device.name();
            subscriber_info[1] = callback_struct.attr_name;
            subscriber_info[2] = "subscribe";
            subscriber_info[3] = callback_struct.event_name;
            subscriber_in.insert(subscriber_info);
            event_channel_struct.adm_device_proxy.command_inout("EventSubscriptionChange", subscriber_in);
            event_channel_struct.heartbeat_skipped = false;
            event_channel_struct.last_subscribed = System.currentTimeMillis();
            callback_struct.last_subscribed = event_channel_struct.last_subscribed;
        } catch (Exception e) {
            retVal = false;
        }
        return retVal;
    }
1067800
def subscribe(self, topic, channel):
        """"""
        self.send(nsq.subscribe(topic, channel))
1313170
public static <E extends Event> void subscribe(Class<E> event, final Listener<E> listener) {
        getEventBus().subscribe(event, listener);
    }
1006533
protected function _actionAddsubscriber(AnCommandContext $context)
    {
        if ($subscription = $this->_subscriber->subscribeTo($this->getItem())) {
            $subscription->endDate = $context->data->endDate;
        }
    }
225189
public static void removeSubscription(Subscription subscription) {
        mSubscriptions.remove(subscription);
        LiveQueryClient.executeQuery(subscription.getQuery().unsubscribeQueryToString());
    }
1136650
def event_subscriber(event):
    
    def wrapper(method):
        Registry.register_event(event.name, event, method)
    return wrapper
773006
private void reSubscribeByName(EventChannelStruct eventChannelStruct, String name) {

        //  Get the map and the callback structure for channel
        Hashtable<String, EventCallBackStruct>
                callBackMap = EventConsumer.getEventCallbackMap();
        EventCallBackStruct callbackStruct = null;
        Enumeration channelNames = callBackMap.keys();
        while (channelNames.hasMoreElements()) {
            String  key = (String) channelNames.nextElement();
            EventCallBackStruct eventStruct = callBackMap.get(key);
            if (eventStruct.channel_name.equals(name)) {
                callbackStruct = eventStruct;
            }
        }

        //  Get the callback structure
        if (callbackStruct!=null) {
            callbackStruct.consumer.reSubscribeByName(eventChannelStruct, name);
        }
    }
502953
function Subscriber(opts) {
  opts = opts || {};

  this._channel = opts.channel || 'default';
  this._subscribers = [];

  /* for mocking */
  var addEventListener = opts.addEventListener || window.addEventListener;
  var attachEvent = opts.attachEvent || window.attachEvent;

  var _this = this;
  function onMessage(e) {
    var event = parse(e.data);
    if (event.channel === _this._channel) {
      for (var i = 0, len = _this._subscribers.length; i < len; i++) {
        _this._subscribers[i].apply({}, event.args);
      }
    }
  }

  if (addEventListener) {
    addEventListener('message', onMessage, false);
  } else {
    attachEvent('onmessage', onMessage, false);
  }
}
732348
@Override
    public <T extends EventListener> void subscribe(EventPublisher source, T listener) {
	checkPermission();
	if (source == null || listener == null) {
	    throw new IllegalArgumentException("Parameters cannot be null");
	}
	super.subscribe(source, listener);
    }
469331
@Override
	public Promise subscribe(String channel) {
		if (status.get() == STATUS_CONNECTED) {
			return clientSub.subscribe(channel);
		}
		return Promise.resolve();
	}
356854
public void assertSubscriptions() {
        for (String channel : subscribers.keySet()) {
            try {
                subscribers.put(channel, null);
                subscribe(channel);
            } catch (Throwable e) {
                break;
            }
        }
    }
551647
@Override
	public void subscribeToEvent(EventListener eventListener, Class<? extends AbstractTaskEvent> eventType) {
		this.eventHandler.subscribeToEvent(eventListener, eventType);
	}
998069
@Override
    public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent event) {
        // register the newly established channel
        Channel channel = event.getChannel();
        LOG.info("connection established to :{}, local port:{}", client.getRemoteAddr(), channel.getLocalAddress());

        client.connectChannel(ctx.getChannel());
        client.handleResponse(ctx.getChannel(), null);
    }
993390
public void subscribeTo(final K key, final Subscriber<V> subscriber) {
        registered.get(key)
                  .stream()
                  .subscribe(subscriber);

    }
233202
protected function invokeSubscription(IEventSubscription $subscription, IEvent $event) {
        foreach ($this->invokers as $invoker) {
            if ($invoker->invoke($subscription, $event)) {
                return;
            }
        }

        $subscriber = $subscription->getSubscriber();

        throw new Exception(
            s('Could not invoke subscriber "%s".',
                is_scalar($subscriber) ? $subscriber : get_type($subscriber))
        );
    }