atwss#

Connects to Aternos WebSocket API for real-time information

AternosWss #

Class for managing websocket connection

__init__(atserv, autoconfirm=False) #

Class for managing websocket connection

Parameters:

Name Type Description Default
atserv AternosServer

atserver.AternosServer instance

required
autoconfirm bool

Automatically start server status listener when AternosWss connects to API to confirm server launching

False

close() async #

Closes websocket connection and stops all listeners

confirm() async #

Simple way to call AternosServer.confirm from this class

connect() async #

Connects to the websocket server and starts all stream listeners

keepalive() async #

Each 49 seconds sends keepalive ping to websocket server

receiver() async #

Receives messages from websocket servers and calls user's streams listeners

send(obj) async #

Sends a message to websocket server

Parameters:

Name Type Description Default
obj Union[Dict[str, Any], str]

Message, may be a string or a dict

required

wssreceiver(stream, *args) #

Decorator that marks your function as a stream receiver. When websocket receives message from the specified stream, it calls all listeners created with this decorator.

Parameters:

Name Type Description Default
stream Streams

Stream that your function should listen

required
*args tuple

Arguments which will be passed to your function

()

Returns:

Type Description
Callable[[FunctionT], Any]

...

wssworker() async #

Starts async tasks in background for receiving websocket messages and sending keepalive ping

Streams #

Bases: enum.Enum

WebSocket streams types