2. Client Connection

The IPC client is very simple. It will simply connect to your server process and send JSON data. If you do not supply a port on initialisation, the client will connect to the multicast server (see the server section) and return the port from said server. If you do supply a port, it will connect to the server instantly.

Requests are made by calling ipc.client.request(endpoint, **kwargs) and will be sent to the server in the json format specified above. It will then wait for a response and return the data.

class nextcord.ext.ipc.client.Client(host='localhost', port=None, multicast_port=20000, secret_key=None)

Handles webserver side requests to the bot process.

Parameters
  • host (str) – The IP or host of the IPC server, defaults to localhost

  • port (int) – The port of the IPC server. If not supplied the port will be found automatically, defaults to None

  • secret_key (Union[str, bytes]) – The secret key for your IPC server. Must match the server secret_key or requests will not go ahead, defaults to None

await init_sock()

Attempts to connect to the server

Returns

The websocket connection to the server

Return type

ClientWebSocketResponse

await request(endpoint, **kwargs)

Make a request to the IPC server process.

Parameters
  • endpoint (str) – The endpoint to request on the server

  • **kwargs – The data to send to the endpoint