-
Notifications
You must be signed in to change notification settings - Fork 2
Protocol documentation.
DMconnect protocol uses TCP (RFC 973) as the transport layer. The connection is persistent, once established, the client and server can exchange data continuously without reconnecting.
All data in the protocol is encoded in UTF-8. This allows for the transmission of text in any language and ensures compatibility between different systems.
The maximum permissible size of data transmitted per packet is 32,768 bytes.
Each technical packet (command message) always begins with the character / (byte 2F).
The keep-alive packet is a single-byte 2F packet. After each keep-alive, the server responds with a *Ping* packet (2A 50 69 6E 67 2A in byte form).
It is recommended to send a keep-alive packet every 30 seconds.
For each new connection, the server immediately sends a packet:
Enter command (/login /register):
For any messages from the client that do not begin with: /login, /register, /, the server will resend the welcome message.
The /login package has the following structure:
/login NAME PASSWORD
1. If this structure is not respected, the server will respond with the following packet:
Usage: /login <username> <password>
And then it will send the greeting message again. So, the data exchange in this case looks like this:
Enter command (/login /register):
> /login <---- user message.
Usage: /login <username> <password>
Enter command (/login /register):
2. If you entered an incorrect username or password (or the user you want to log in as is simply not registered on this server), you will receive the following response:
Invalid username or password.
And then it will send the greeting message again. So, the data exchange in this case looks like this:
Enter command (/login /register):
> /login WRONG_USER WRONG_PASS <---- user message.
Invalid username or password.
Enter command (/login /register):
3. If you have entered the correct username and password, the following will happen:
Login successful. <---- line break.
Available servers: general <---- line break.
Select a server using /join_server <server_name>.
The /register package has the following structure:
/register NAME PASSWORD
1. If this structure is not respected, the server will respond with the following packet:
Usage: /register <username> <password>
And then it will send the greeting message again. So, the data exchange in this case looks like this:
Enter command (/login /register):
> /register <---- user message.
Usage: /reigster <username> <password>
Enter command (/login /register):
2. If the username you are trying to register is already taken, the server will send this packet:
Username already taken. Try another.
And then it will send the greeting message again. So, the data exchange in this case looks like this:
Enter command (/login /register):
> /register TAKEN_USERNAME PASSWORD <---- user message.
Usage: /reigster <username> <password>
Enter command (/login /register):
3. If the account was successfully registered, the following will happen:
Registration successful. Please log in.
Enter command (/login /register):
To send a private message to a user within your server, you must follow the following structure:
/pm USER MESSAGE
If you want to send a private message to a user on another server, you must follow this structure:
/pm USER@SERVER MESSAGE
1. If this structure is not respected, the server will respond with the following packet:
Usage: /pm <username> <message>
2. If the user you want to send a message to is not registered:
User does not exist.
3. If the user you want to send a message to is offline or their server is unavailable:
Failed to send private message to USER.
Or, if you sent the message via the /pm USER@SERVER MESSAGE command:
Failed to send private message to USER@SERVER.
4. If the message was sent successfully, the following will happen:
Private message sent to USER.
Or, if you sent the message via the /pm USER@SERVER MESSAGE command:
Private message sent to USER@SERVER.
If someone sends you a private message, you will receive the following packet:
(Private) USER: MESSAGE
If the sender sent you a message from another server, the packet would look like this:
(Private) USER@SERVER: MESSAGE