public function sendToService(MessageInterface $msg)
    {
        if (!$this->isServiceStreamReady()) {
            $this->getLogger()->debug('Service socket not ready to send.');

            return;
        }

        $this->getLogger()->debug('Sending to service.');
        $this->serviceStreamReady = false;
        $this->serviceStream->send($msg);
    }