-
Notifications
You must be signed in to change notification settings - Fork 0
Server Specifications
GiZano edited this page Jan 23, 2026
·
1 revision
This document defines the strict communication standards required to interact with the Central Server. All client implementations must adhere to these rules to ensure interoperability.
- Transport Layer: TCP/IP
-
Default Port:
65432 -
Bind Address:
0.0.0.0(The server listens on all network interfaces). - Encoding: UTF-8
The server parses incoming byte streams as JSON objects. Every message—without exception—must conform to the following schema.
{
"from": {
"name": "SenderUsername",
"ip": "SenderIP"
},
"to": "RecipientUsername",
"msg": "Text Payload"
}| Field | Type | Description |
|---|---|---|
from |
Object | Container for sender details. |
from.name |
String | Unique identifier chosen by the user. |
from.ip |
String | The local IP address of the sender (for logging). |
to |
String | Exact username of the recipient. |
msg |
String | The actual message content. |
Critical: Messages that do not contain these exact keys will be discarded by the server's
try-exceptblock in the JSON decoder.
Upon establishing a TCP connection, the client must immediately send its Username as raw bytes (encoded in UTF-8).
-
Action: Client sends
b'MyName'. -
Server Logic: Registers the socket in the internal
clientsdictionary map.
The client enters a loop sending JSON-formatted strings.
-
Server Logic: Decodes JSON -> Extracts
tofield -> Looks up destination socket -> Forwards the original JSON packet to the recipient.
When a client closes the socket:
-
Server Logic: Detects empty byte stream -> Removes user from
clientsmap -> Logs disconnection.
-
/standard: If the payloadmsgequals/standard, the server will reply directly to the sender with a confirmation message, verifying that the JSON structure was parsed correctly.