Send a JSON message to the server.
(self, message: dict)
| 111 | continue |
| 112 | |
| 113 | def _send_message(self, message: dict) -> None: |
| 114 | """Send a JSON message to the server.""" |
| 115 | if not self._socket: |
| 116 | raise RuntimeError("Not connected") |
| 117 | |
| 118 | data = json.dumps(message, separators=(",", ":")) + "\n" |
| 119 | self._socket.sendall(data.encode("utf-8")) |
| 120 | |
| 121 | def command( |
| 122 | self, |