pip install webrcon
Initializes the class with the following parameters:
host: str
- The IP address or hostname of the server accepting WebRcon connections.port: Union[str, int]
- The port number where the server is accepting WebRcon connections.password: str
- The password required for connecting via WebRcon.message_callback: func
- A synchronous or asynchronous function invoked whenever a chat message is received.console_callback: func
- A synchronous or asynchronous function invoked whenever a console message is received.
The following methods are all coroutines (and need to be awaited)
Opens a connection to the server
loop
- an asyncio event loop, can be obtained through asyncio.get_event_loop()kwargs
- passed to websockets.client.connect - read the docs
Closes the connection to the server
Sends a command over RCON to the server
command: str
- The command you want to be sent to the servercallback: func
- A sync/async function that should take a single argument. The passed value will be a dict consisting of the output from the RCON server.
The response to your command will be under theMessage
key.
Your host/port/password combination is incorrect or the server isn't running.
The connection was closed but a command was still attempted.