config = $config; } public function submit(string $category, ?string $userId = null, $data = null) { if (!$data) $data = (object) []; $dsn = $this->config->get('webSocketSubmissionDsn', 'tcp://localhost:5555'); $data->userId = $userId; $data->category = $category; try { $context = new \ZMQContext(); $socket = $context->getSocket(\ZMQ::SOCKET_PUSH, 'my pusher'); $socket->connect($dsn); $socket->send(json_encode($data)); } catch (\Throwable $e) { $GLOBALS['log']->error("WebSocketSubmission: " . $e->getMessage()); } } }