socha.api.protocol.protocol

Module Contents

Classes

Row

Board

Coordinate

LastMove

Player

State

A RoomMessage that can be received by observers.

OriginalRequest

Errorpacket

Left

If the game is over the server will _send this message to the clients and closes the connection afterward.

MoveRequest

Request a client to _send a Move.

Close

Is sent by one party immediately before this party closes the communication connection and should make the

Authenticate

Authenticates a client as administrator to _send AdminLobbyRequest`s.

Cancel

Deletes the GameRoom and cancels the Game within.

JoinedGameRoom

Sent to all administrative clients after a player joined a GameRoom via a JoinRoomRequest.

Observe

Sent to client as response to successfully joining a GameRoom as Observer.

Pause

Indicates to observers that the game has been (un)paused.

Slot

Slots for a game which contains the player's name and its attributes.

Step

When the client is authenticated as administrator,

Prepare

When the client is authenticated as administrator,

Join

Joins any room that is open.

JoinPrepared

Join a prepared room with a reservation code.

JoinRoom

To join a room with a room_id.

Fragment

This holds the fragments of a winning definition.

Joined

Sent to all clients after a player joined a GameRoom via a Join Request.

Score

Score of the players when the game has ended.

Winner

Definition

The definition of a result of a game.

Entry

Is _send when a game is won by one of the players.

Scores

Then result of a game when its over.

WelcomeMessage

Welcome message is sent to the client when the client joins the room.

Result

Result of a game.

OriginalMessage

The original message that was sent by the client.

Error

This sends the server when the client sent a erroneous message.

Data

Room

Observed

A RoomMessage that does not concern the progress of the game.

Prepared

A RoomMessage that does not concern the progress of the game.

Protocol

This is the root element of the protocol.

class socha.api.protocol.protocol.Row
class Meta
name = 'row'
field_value: List[str]
class socha.api.protocol.protocol.Board
class Meta
name = 'board'
rows: List[Row]
class socha.api.protocol.protocol.Coordinate
class Meta
name = 'from'
x: int | None
y: int | None
class socha.api.protocol.protocol.LastMove
class Meta
name = 'lastMove'
class_binding: object | None
from_: Coordinate | None
direction: str | None
class socha.api.protocol.protocol.Player
class Meta
name = 'player'
name: str | None
team: str | None
class socha.api.protocol.protocol.State

Bases: socha.api.protocol.room_message.ObservableRoomMessage

A RoomMessage that can be received by observers.

class Meta
name = 'state'
class_value: str | None
start_team: str | None
turn: int | None
board: Board | None
last_move: LastMove | None
class socha.api.protocol.protocol.OriginalRequest

Bases: socha.api.protocol.protocol_packet.ProtocolPacket

class Meta
name = 'originalRequest'
class_value: str | None
reservation_code: str | None
class socha.api.protocol.protocol.Errorpacket

Bases: socha.api.protocol.protocol_packet.ProtocolPacket

class Meta
name = 'errorpacket'
message: str | None
original_request: OriginalRequest | None
class socha.api.protocol.protocol.Left

Bases: socha.api.protocol.protocol_packet.ProtocolPacket

If the game is over the server will _send this message to the clients and closes the connection afterward.

class Meta
name = 'left'
room_id: str | None
class socha.api.protocol.protocol.MoveRequest

Bases: socha.api.protocol.room_message.RoomMessage

Request a client to _send a Move.

class socha.api.protocol.protocol.Close

Bases: socha.api.protocol.protocol_packet.ProtocolPacket

Is sent by one party immediately before this party closes the communication connection and should make the receiving party also close the connection.

This should not be sent manually, the XFluxClient will automatically _send it when stopped.

class Meta
name = 'close'
class socha.api.protocol.protocol.Authenticate

Bases: socha.api.protocol.protocol_packet.AdminLobbyRequest

Authenticates a client as administrator to _send AdminLobbyRequest`s. Is not answered if successful.

class Meta
name = 'authenticate'
password: str | None
class socha.api.protocol.protocol.Cancel

Bases: socha.api.protocol.protocol_packet.AdminLobbyRequest

Deletes the GameRoom and cancels the Game within.

class Meta
name = 'cancel'
room_id: str | None
class socha.api.protocol.protocol.JoinedGameRoom

Bases: socha.api.protocol.room_message.ObservableRoomMessage

Sent to all administrative clients after a player joined a GameRoom via a JoinRoomRequest.

class Meta
name = 'joinedGameRoom'
room_id: str | None
player_count: int | None
class socha.api.protocol.protocol.Observe

Bases: socha.api.protocol.protocol_packet.AdminLobbyRequest

Sent to client as response to successfully joining a GameRoom as Observer.

class Meta
name = 'observe'
room_id: str | None
class socha.api.protocol.protocol.Pause

Bases: socha.api.protocol.protocol_packet.AdminLobbyRequest

Indicates to observers that the game has been (un)paused.

class Meta
name = 'pause'
room_id: str | None
pause: bool | None
class socha.api.protocol.protocol.Slot

Bases: socha.api.protocol.room_message.RoomOrchestrationMessage

Slots for a game which contains the player’s name and its attributes.

class Meta
name = 'slot'
display_name: str | None
can_timeout: bool | None
reserved: bool | None
class socha.api.protocol.protocol.Step

Bases: socha.api.protocol.room_message.RoomOrchestrationMessage

When the client is authenticated as administrator, it can _send this step request to the server to advance the game for one move. This is not possible if the game is not paused.

class Meta
name = 'step'
room_id: str | None
class socha.api.protocol.protocol.Prepare

Bases: socha.api.protocol.room_message.RoomOrchestrationMessage

When the client is authenticated as administrator, it can _send this request to prepare the room for the game.

class Meta
name = 'prepare'
game_type: str | None
pause: bool | None
slot: List[Slot]
class socha.api.protocol.protocol.Join

Bases: socha.api.protocol.protocol_packet.LobbyRequest

Joins any room that is open. If no room is open, a new room is created by the server.

class Meta
name = 'join'
class socha.api.protocol.protocol.JoinPrepared

Bases: socha.api.protocol.protocol_packet.LobbyRequest

Join a prepared room with a reservation code.

class Meta
name = 'joinPrepared'
reservation_code: str | None
class socha.api.protocol.protocol.JoinRoom

Bases: socha.api.protocol.protocol_packet.LobbyRequest

To join a room with a room_id.

class Meta
name = 'joinRoom'
room_id: str | None
class socha.api.protocol.protocol.Fragment

This holds the fragments of a winning definition.

class Meta
name = 'fragment'
name: str | None
aggregation: str | None
relevant_for_ranking: bool | None
class socha.api.protocol.protocol.Joined

Bases: socha.api.protocol.protocol_packet.ResponsePacket

Sent to all clients after a player joined a GameRoom via a Join Request.

class Meta
name = 'joined'
room_id: str | None
class socha.api.protocol.protocol.Score

Score of the players when the game has ended.

class Meta
name = 'score'
part: List[int]
class socha.api.protocol.protocol.Winner
class Meta
name = 'winner'
team: str | None
regular: bool | None
reason: str | None
class socha.api.protocol.protocol.Definition

The definition of a result of a game. If for instance one player made an error move, the game is over and the other player wins, the definition will tell that the other player wins, because of the error.

class Meta
name = 'definition'
fragment: List[Fragment]
class socha.api.protocol.protocol.Entry

Is _send when a game is won by one of the players. This element contains the winning player and the score of the player.

class Meta
name = 'entry'
player: Player | None
score: Score | None
class socha.api.protocol.protocol.Scores

Then result of a game when its over.

class Meta
name = 'scores'
entry: List[Entry]
class socha.api.protocol.protocol.WelcomeMessage

Bases: socha.api.protocol.room_message.RoomOrchestrationMessage

Welcome message is sent to the client when the client joins the room. In this message the server tells the client which team it is.

team: socha._socha.TeamEnum
class socha.api.protocol.protocol.Result

Bases: socha.api.protocol.room_message.ObservableRoomMessage

Result of a game. This will the server _send after a game is finished.

definition: Definition
scores: Scores
winner: Winner
class socha.api.protocol.protocol.OriginalMessage

The original message that was sent by the client. Is sent by the server if an error occurs.

class Meta
name = 'originalMessage'
class_value: str | None
from_: Coordinate | None
direction: str | None
class socha.api.protocol.protocol.Error

This sends the server when the client sent a erroneous message.

message: str
originalMessage: OriginalMessage
class socha.api.protocol.protocol.Data
class Meta
name = 'data'
class_value: str | None
class_binding: object | None
definition: Definition | None
original_message: OriginalMessage | None
scores: Scores | None
winner: Winner | None
state: State | None
color: str | None
from_: Coordinate | None
direction: str | None
class socha.api.protocol.protocol.Room

Bases: socha.api.protocol.protocol_packet.ProtocolPacket

class Meta
name = 'room'
room_id: str | None
data: Data | None
class socha.api.protocol.protocol.Observed

Bases: socha.api.protocol.room_message.RoomOrchestrationMessage

A RoomMessage that does not concern the progress of the game.

class Meta
name = 'observed'
room_id: str | None
class socha.api.protocol.protocol.Prepared

Bases: socha.api.protocol.room_message.RoomOrchestrationMessage

A RoomMessage that does not concern the progress of the game.

class Meta
name = 'prepared'
room_id: str | None
reservation: List[str]
class socha.api.protocol.protocol.Protocol

This is the root element of the protocol. Even it’s in here it will never be called, because the children of this root element have to be handled separately.

class Meta
name = 'protocol'
authenticate: Authenticate | None
joined_game_room: JoinedGameRoom | None
prepare: Prepare | None
observe: Observe | None
pause: Pause | None
step: Step | None
cancel: Cancel | None
join: Join | None
joined: Joined | None
room: List[Room]
prepared: Prepared | None
observed: Observed | None