Push websocket message to clients.

@param \Swoole\Websocket\Server $server
@param mixed $data
4905
public function pushMessage($server, array $data)
    {
        $pusher = Pusher::make($data, $server);
        $pusher->push($this->payloadParser->encode(
            $pusher->getEvent(),
            $pusher->getMessage()
        ));
    }
1093954
public function writeAsync($data)
    {
        $this->dataBuffer .= $this->buffer->encodeMessage(serialize($data));
        if ($this->writeEvent === false)
        {
            $this->loop->addWriteStream($this->connection, function ($stream, LoopInterface $loop)
            {
                if (strlen($this->dataBuffer) > 0)
                {
                    $dataWritten = fwrite($stream,$this->dataBuffer);
                    $this->dataBuffer = substr($this->dataBuffer,$dataWritten);
                    if(strlen($this->dataBuffer) <= 0)
                    {
                        $loop->removeWriteStream($stream);
                        $this->writeEvent = false;
                    }
                }
            });
            $this->writeEvent = true;
        }
    }
512105
public function onMessage($server, $frame)
    {
        // execute parser strategies and skip non-message packet
        if ($this->payloadParser->execute($server, $frame)) {
            return;
        }

        /** @var Websocket $websocket */
        $websocket = $this->app->make(Websocket::class);
        /** @var Sandbox $sandbox */
        $sandbox = $this->app->make(Sandbox::class);

        try {
            // decode raw message via parser
            $payload = $this->payloadParser->decode($frame);

            $websocket->reset(true)->setSender($frame->fd);

            // enable sandbox
            $sandbox->init();

            // dispatch message to registered event callback
            ['event' => $event, 'data' => $data] = $payload;
            $websocket->eventExists($event)
                ? $websocket->call($event, $data)
                : $this->websocketHandler->onMessage($frame);
        } catch (Throwable $e) {
            $this->logServerError($e);
        } finally {
            // disable and recycle sandbox resource
            $sandbox->clear();
        }
    }
503485
public function push(string $data) {
        $result = hash_update($this->getHandle(), $data);
        if(!$result) {
            throw new RuntimeException();
        }
    }
298622
private function response($socket, array $data) {
        $msg = json_encode($data, JSON_UNESCAPED_SLASHES) . "\r\n\r\n";
        @socket_write($socket, $msg, strlen($msg));
    }
583108
private function send($data)
	{
		$rawMessage = json_encode($data);
		$payload = new WebsocketPayload;
		$payload->setOpcode(WebsocketPayload::OPCODE_TEXT)
				->setMask(TRUE)
				->setPayload($rawMessage);
		$encoded = $payload->encodePayload();
		fwrite($this->fd, $encoded);

		return $this;
	}
609848
public function setData($data)
    {
        if (!is_string($data)) {
            $data = json_encode($data);
        }

        $this->data = $data;
    }
700081
public function doPacket(swoole_server $server, $data, $clientInfo)
    {
        $data = Json::decode($data);
        $request = new ServerRequest($data['method'], $data['path']);
        if (isset($data['args'])) {
            if ('GET' === $request->getMethod()) {
                $request->withQueryParams($data['args']);
            } else {
                $request->withParsedBody($data['args']);
            }
        }
        $response = app()->handleRequest($request);
        $server->sendto($clientInfo['address'], $clientInfo['port'], (string) $response->getBody());
        app()->shutdown($request, $response);

        return 0;
    }
1205000
public function onMessage($server, $frame) {
        $data = json_decode($frame->data, true);
        $method = $data[ 'method' ];
        unset($data[ 'method' ]);
        $user_id = $this->fidToUserId($frame->fd);
        /* @var $service WebSocketService */
        $service = Ioc::get($this->config[ 'service' ]);
        $service->$method($user_id, $data);
        CoContext::getContext()->release();
    }
114225
public function push(string $imageName, string $server = null) {

		$this->requireProcess();

		$process = ProcessBuilder::create([
			'docker', 'push', $imageName
		])
			->setTimeout(null)->getProcess();

		$this->processHelper->run($this->output, $process, null, null, OutputInterface::VERBOSITY_NORMAL);
		if($process->getExitCode() !== 0)
			throw new PushFailedException($imageName, 20);
	}
392781
public function sendJson($data)
	{
		if ($data === null) {
			$this->terminate();
		}else{
			$this->sendResponse(new JsonResponse($data));
		}
	}
1137098
public function push($queue, $item)
    {
        // Add the queue to the list of queues
        $this->getClient()->sadd($this->getKey(self::QUEUES_KEY), $queue);

        // Add the job to the specified queue
        $this->getClient()->rpush($this->getKey(self::QUEUE_KEY . $queue), json_encode($item));
    }
229156
public function handle(string $data)
    {
        if (!$this->payload) {
            $this->payload = $this->protocol->getPayload();
        }

        while ($data) { // Each iteration pulls off a single payload chunk
            $size = strlen($data);
            $remaining = $this->payload->getRemainingData();

            // If we don't yet know how much data is remaining, read data into
            // the payload in two byte chunks (the size of a WebSocket frame
            // header to get the initial length)
            //
            // Then re-loop. For extended lengths, this will happen once or four
            // times extra, as the extended length is read in.
            if ($remaining === null) {
                $chunkSize = 2;
            } elseif ($remaining > 0) {
                $chunkSize = $remaining;
            } elseif ($remaining === 0) {
                $chunkSize = 0;
            }

            $chunkSize = min(strlen($data), $chunkSize);
            $chunk = substr($data, 0, $chunkSize);
            $data = substr($data, $chunkSize);

            $this->payload->receiveData($chunk);

            if ($remaining !== 0 && !$this->payload->isComplete()) {
                continue;
            }

            if ($this->payload->isComplete()) {
                $this->emit($this->payload);
                $this->payload = $this->protocol->getPayload();
            } else {
                throw new PayloadException('Payload will not complete');
            }
        }
    }
827668
public function push($payload): void
    {
        // attach sender if not broadcast
        if (! $this->broadcast && $this->sender && ! $this->hasDescriptor($this->sender)) {
            $this->addDescriptor($this->sender);
        }

        // check if to broadcast to other clients
        if ($this->shouldBroadcast()) {
            $this->addDescriptors($this->getWebsocketConnections());
        }

        // push message to designated fds
        foreach ($this->descriptors as $descriptor) {
            if ($this->shouldPushToDescriptor($descriptor)) {
                $this->server->push($descriptor, $payload, $this->opcode);
            }
        }
    }
996761
protected function _send($data) {
		if (fwrite($this->_connection(), $data, strlen($data)) === false) {
			throw new NetworkException('Could not send registration to Growl Server.');
		}
		return true;
	}
326293
public function onFinish(Server $server, int $taskId, $data)
    {
        array_walk($this->handlers[$data['name']], function ($name) {
            $handler = $this->createHandler($name);
            $handler->finish($data['result']);
            unset($handler);
        });
    }
206369
public function onReceive(Server $server, int $fd, int $fromId, string $data)
    {
        /** @var \Swoft\Rpc\Server\ServiceDispatcher $dispatcher */
        $dispatcher = App::getBean('ServiceDispatcher');
        $dispatcher->dispatch($server, $fd, $fromId, $data);
    }