Clone
2
Networking protocol
Simon Pribylski edited this page 2025-03-12 13:48:41 +00:00

Types

ServerResponse

Name Value Description
AuthSuccess 0 The chatter is successfully authenticated
AuthError 1 The chatter want to connect with a name already used
RoomCreated 2 The room has been created
RoomNotCreated 3 A room with the same name already exists
RoomJoined 4 The chatter joined the room
RoomNotJoined 5 The name of the room does not exist
NotInRoom 6 The chatter must be in a room to send a chat message or leave a room

Packets

Client <--> Server

AcknowlegdementPacket

The receiver sends this packet to confirm the successful receive to the sender

Name Type Description
Ack Int The sequence number of the received packet

DisconnectPacket

Packet sent by the client or server to indicate that the connexion should be closed

Name Type Description
Reason String The reason

Client --> Server

LoginPacket

The client first send this packet to indicate his name

Name Type Description
Pseudo String The name of the chatter who wants to join

RequestRoomListPacket

The client sends this packet when needing to update the list of rooms available.

This packet has no body.

RequestActualRoomPacket

The client sends this packet when he wants to know in which room he is in.

This packet has no body.

CreateRoomPacket

Create a room by name. The server responds with a ResponsePacket.

Name Type Description
RoomName String The name of the room to create

JoinRoomPacket

Join a room by name.

Name Type Description
RoomName String The name of the room to create

SendChatMessagePacket

Send a chat message

Name Type Description
Content String The chat message to send

LeaveRoomPacket

Leave a room.

This packet has no body

Server --> Client

ChatMessagePacket

Broadcast the chat message

Name Type Description
Time Instant The timestamp of the message
Chatter String The emitter of the message
Content String The chat message to send

ResponsePacket

The server responds to the client when trying to perform operations such as authenticating, joining rooms, creating rooms

Name Type Description
Response Int a ServerResponse depending on the request

ActualRoomPacket

Sends the room in which the client is

Name Type Description
RoomName String The room of the client

RoomListPacket

Sends the list of rooms available.

Name Type Description
RoomNames ArrayList<String> the list of room names