/** * @param string $message */ public function notifyMessage($message) { $this->broker->send($this->shellSocket, 'execute_reply', ['status' => 'ok'], $this->header); $this->broker->send($this->iopubSocket, 'stream', ['name' => 'stdout', 'data' => $message], $this->header); $this->broker->send($this->iopubSocket, 'execute_result', ['execution_count' => $this->execCount + 1, 'data' => $message, 'metadata' => new \stdClass()], $this->header); $this->broker->send($this->iopubSocket, 'status', ['execution_state' => 'idle'], $this->header); }
public function call(array $header, array $content) { // TODO: Implement call() method. $this->broker->send($this->iopubSocket, 'status', ['execution_state' => 'busy'], $header); $this->broker->send($this->shellSocket, 'kernel_info_reply', ['protocol_version' => '5.0.0', 'implementation' => 'jupyter-php', 'implementation_version' => '0.1.0', 'banner' => 'Jupyter-PHP Kernel', 'language' => 'PHP', 'language_version' => phpversion(), 'language_info' => ['name' => 'PHP', 'version' => phpversion(), 'mimetype' => 'text/x-php', 'file_extension' => '.php', 'pygments_lexer' => 'PHP']]); $this->broker->send($this->iopubSocket, 'status', ['execution_state' => 'idle'], $header); }
/** * ShellMessagesHandler constructor. * @param JupyterBroker $broker * @param SocketWrapper $iopubSocket * @param SocketWrapper $shellSocket * @param Logger $logger */ public function __construct(JupyterBroker $broker, SocketWrapper $iopubSocket, SocketWrapper $shellSocket, Logger $logger) { $this->shellSoul = new Shell(); $this->executeAction = new ExecuteAction($broker, $iopubSocket, $shellSocket, $this->shellSoul); $this->historyAction = new HistoryAction($broker, $shellSocket); $this->kernelInfoAction = new KernelInfoAction($broker, $shellSocket, $iopubSocket); $this->shutdownAction = new ShutdownAction($broker, $shellSocket); $this->logger = $logger; $broker->send($iopubSocket, 'status', ['execution_state' => 'starting'], []); $this->shellSoul->setOutput(new KernelOutput($this->executeAction, $this->logger->withName('KernelOutput'))); }
public function call(array $header, array $content) { $this->broker->send($this->shellSocket, 'history_reply', ['history' => []], $header); }