frost package

Module contents

class frost.FrostServer(file: str)

Bases: frost.server.socketio.base_server.BaseServer

The Frost server.

Parameters

file (str) – The __file__ of the file this is imported in

on_user_connect(conn: socket.socket, addr: Tuple[str, int]) → None

Handles the connection of a client and executes tasks accordingly.

Parameters
  • conn ('socket.socket') – The client’s connection

  • addr (Tuple[str, int]) – The user’s IP address and port

run(ip: str = '127.0.0.1', port: int = 5555) → None

Runs the FrostServer.

Parameters
  • ip (str, optional) – The IP for the server to bind to, defaults to ‘127.0.0.1’

  • port (int, optional) – The port for the server to bind to, defaults to 5555

class frost.FrostClient(ip: str = '127.0.0.1', port: int = 5555)

Bases: frost.client.socketio.base_client.BaseClient

The Frost Client.

Parameters
  • ip (str, optional) – The IP address of the server to connect to, defaults to ‘127.0.0.1’

  • port (int, optional) – The port of the server to connect to, defaults to 5555

connect() → None

Connect to the server and begin listening for events.

create_room(room_name: str, token: str, id_: str) → None

Create a new room in a server.

Parameters
get_invite_code(room_id: int, token: str, id_: str) → None

Get the invite code of a room in a server.

Parameters
get_joined_rooms(token: str, id_: str) → None

Get all the joined rooms of the currently logged in user.

Parameters
get_room_members(room_id: int, token: str, id_: str) → None

Get all the members of a specific room.

Parameters
get_room_msgs(room_id: int, token: str, id_: str) → None

Get all messages from a specific room in a server.

Parameters
join_room(invite_code: str, token: str, id_: str) → None

Join a room in a server with an invite code.

Parameters
leave_room(room_id: int, token: str, id_: str) → None

Leave a joined room in a server.

Parameters
login(username: str, password: str) → None

Login to the server.

Parameters
  • username (str) – The username of the account

  • password (str) – The password of the account

register(username: str, password: str) → None

Register an account on the server.

Parameters
  • username (str) – The desired username of the account

  • password (str) – The desired password of the account

send_msg(room_id: int, msg: str, token: str, id_: str) → None

Send a message to other users on a server in a specific room.

Parameters
class frost.Cog

Bases: object

Children of this class and its methods are automatically routed and then handled by frost.ext.handler.Handler. Private methods of the children are ignored and not routed. All children methods are automatically run as static methods.

Raises

DirectCogInstanceError – If this class is directly instantiated. This class can only be subclassed.

class frost.Handler

Bases: object

Handles incoming requests and executes methods according to the route path mapping.

handle(data: Dict[str, Any], **kwargs) → None

Handles the route and executes the resulting method.

Parameters

data (Dict[str, Any]) – Data received from the server