Listener task for receiving ops from Lavalink.
351691
async def listener(self):
        
        while self._ws.open and self._is_shutdown is False:
            try:
                data = json.loads(await self._ws.recv())
            except websockets.ConnectionClosed:
                break

            raw_op = data.get("op")
            try:
                op = LavalinkIncomingOp(raw_op)
            except ValueError:
                socket_log.debug("Received unknown op: %s", data)
            else:
                socket_log.debug("Received known op: %s", data)
                self.loop.create_task(self._handle_op(op, data))

        self.ready.clear()
        log.debug("Listener exited: ws %s SHUTDOWN %s.", self._ws.open, self._is_shutdown)
        self.loop.create_task(self._reconnect())
702390
public void invokeHookEmit(List<Object> values, String stream, Collection<Integer> outTasks) {
    if (taskHooks.size() != 0) {
      EmitInfo emitInfo = new EmitInfo(values, stream, getThisTaskId(), outTasks);
      for (ITaskHook taskHook : taskHooks) {
        taskHook.emit(emitInfo);
      }
    }
  }
271002
async def listen(self):
        ""
        if self.subscribed:
            return self.handle_message(await self.parse_response(block=True))
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)
1196441
def sendTo(self, dest, chunkSize):
        
        vol = self.toVol
        paths = self.sink.getPaths(vol)

        if self.sink == dest:
            logger.info("Keep: %s", self)
            self.sink.keep(self)
        else:
            # Log, but don't skip yet, so we can log more detailed skipped actions later
            skipDryRun(logger, dest.dryrun, 'INFO')("Xfer: %s", self)

            receiveContext = dest.receive(self, paths)

            sendContext = self.sink.send(self)

            # try:
            #     receiveContext.metadata['btrfsVersion'] = self.btrfsVersion
            # except AttributeError:
            #     pass

            transfer(sendContext, receiveContext, chunkSize)

        if vol.hasInfo():
            infoContext = dest.receiveVolumeInfo(paths)

            if infoContext is None:
                # vol.writeInfo(sys.stdout)
                pass
            else:
                with infoContext as stream:
                    vol.writeInfo(stream)
1236420
def receive(self, data, api_context):
        """"""
        self.log.debug(f"Putting data on the pipeline: {data}")
        result = {
            "api_contexts": self.api_contexts,
            "api_context": api_context,
            "strategy": dict(),  # Shared strategy data
            "result": data,
            "log_level": api_context["log_level"],
        }
        self.strat.execute(self.strategy_context_schema().load(result).data)
1276787
def run(self):
        """"""
        while self.keep_listening:
            for interface in self.node.interfaces:
                try:
                    self.recv(self.node.inq[interface].get(timeout=0), interface)
                except Empty:
                    sleep(0.01)
1292206
def show_listener(self, lbaas_listener, **_params):
        """"""
        return self.get(self.lbaas_listener_path % (lbaas_listener),
                        params=_params)
664054
def _recv_thread(self):
        
        for msg, metadata in self._source:
            if msg.msg_type:
                self._call(msg, **metadata)
        # Break any upstream iterators
        for sink in self._sinks:
            i = sink()
            if i is not None:
                i.breakiter()
        self._dead = True
1058757
function listenerAtPhase(inst, event, propagationPhase) {
  var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  return getListener(inst, registrationName);
}
501059
function listenerFn(msgObj) {
      channel._addEL[msgObj.type].forEach(function (obj) {
        if (msgObj.time >= obj.time) {
          obj.fn(msgObj.data);
        }
      });
    }
601727
def listen(self):
        
        with Consumer(self.connection, queues=self.queue, on_message=self.on_message,
                      auto_declare=False):
            for _ in eventloop(self.connection, timeout=1, ignore_timeouts=True):
                    pass
500100
function listen(self, address, port, addressType, backlog, exclusive) {
    /* TODO Index servers by a self-assigned identifier and the process
     * identifier so messages intended for previous instances do not pass
     * through. */
    servers[port] = self; // Index servers by port.
    self._port = port; // Remember the requested port for close.
    process.send({
        cmd: 'CLUSTER_LISTEN',
        port: port,
        address: address, // For confirmation purposes only.
        addressType: addressType, // We allow the supervisor to infer the address type.
        backlog: backlog, // Used to confirm uniformity of worker requests.
        exclusive: exclusive // TODO use this on the other end
    });
}
273811
@Override
	public void on(String name, Tree payload, Groups groups, boolean broadcast) throws Exception {

		// A.) Async invocation
		if (asyncLocalInvocation) {
			executor.execute(() -> {
				try {
					listener.on(payload);
				} catch (Exception cause) {
					logger.warn("Unable to invoke local listener!", cause);
				}
			});
			return;
		}

		// B.) Faster in-process (direct) invocation
		listener.on(payload);
	}
1258841
protected void runEchoService(ServerSocket serverSocket) {
    if (isRunning(serverSocket)) {

      echoService = newExecutorService();

      echoService.submit(() -> {
        try {
          while (isRunning(serverSocket)) {
            Socket echoClient = serverSocket.accept();

            getLogger().info(() -> String.format("EchoClient connected from [%s]",
              echoClient.getRemoteSocketAddress()));

            echoService.submit(() -> {
              sendResponse(echoClient, receiveMessage(echoClient));
              close(echoClient);
            });
          }
        }
        catch (IOException cause) {
          if (isRunning(serverSocket)) {
            getLogger().warning(() -> String.format("An IO error occurred while listening for EchoClients:%n%s",
              ThrowableUtils.getStackTrace(cause)));
          }
        }
      });

      getLogger().info(() -> String.format("EchoServer running on port [%d]", getPort()));
    }
  }
865609
private void deliverSyncCommand(byte command) {
        for (final SyncListener listener : getSyncListeners()) {
            try {
                switch (command) {

                    case 0x01:
                        listener.becomeMaster();

                    case 0x10:
                       listener.setSyncMode(true);
                       break;

                    case 0x20:
                        listener.setSyncMode(false);
                        break;

                }
            } catch (Throwable t) {
                logger.warn("Problem delivering sync command to listener", t);
            }
        }
    }
630694
async def stream(self, ctx, *, url):
        """"""

        async with ctx.typing():
            player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True)
            ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)

        await ctx.send('Now playing: {}'.format(player.title))