-
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
After a successful login, the server sends a list of available subservers and asks you to select one using /join_server. Each subserver is an isolated chat room. Users can communicate only within the subserver they have joined.
Each session can be connected to only one subserver at a time. The same account may have several active sessions; each session may join a different subserver, and messages from a subserver are delivered only to the session connected to it.
- Creating a subserver.
- Joining a subserver.
- Listing servers.
- Members list.
- Public chat.
- Chat actions.
- Join and leave notifications.
To create a new subserver, use the following structure:
/create_server SERVER_NAME
1. If this structure is not respected, the server will respond with the following packet:
Usage: /create_server <server_name>
2. If a server with this name already exists:
Server already exists.
3. If the server was created successfully:
Server 'SERVER_NAME' created successfully.
The /join_server packet has the following structure:
/join_server SERVER_NAME
To join a server on another DMconnect host, use:
/join_server SERVER_NAME@HOST
Where HOST is the domain name or IP address of the remote server.
1. If this structure is not respected, the server will respond with the following packet:
Usage: /join_server <server_name>
2. If the specified server does not exist (locally or on the remote host):
Server does not exist.
3. If you are already connected to a server:
You're already connected to the server 'CURRENT_SERVER'.
4. If you joined a server successfully:
Joined server 'SERVER_NAME' successfully.
Or, for a remote server:
Joined server 'SERVER_NAME@HOST' successfully.
To get a list of all subservers available on this host:
/list_servers
The server will respond with:
Servers: general, SERVER_NAME, ...
To get a list of users currently present on your server:
/members
1. If you are not logged in or have not joined a server:
Please log in and join a server first.
2. On a local server, if the request was successful:
Members in 'SERVER_NAME': USER1, USER2, USER3@remote.host
Users from other hosts are displayed with the @HOST suffix.
3. On a remote server (SERVER_NAME@HOST), if the request failed:
Failed to fetch members.
After joining a server, any message that does not begin with / is treated as a public chat message and is broadcast to all members of the current server.
On a local server, other participants receive:
USER: MESSAGE
If the sender is connected from another host, the packet looks like this:
USER@HOST: MESSAGE
On a remote server (SERVER_NAME@HOST), your messages are forwarded to that host. Other participants see them with your username; remote users appear to you as USER@HOST.
To perform a chat action (status message), use the following structure:
/act ACTION
1. If this structure is not respected:
Usage: /act <act>
2. If you are not logged in or have not joined a server:
Please log in and join a server first.
3. Reserved action texts are not allowed:
This action is not allowed.
The following strings cannot be used as actions: has joined the server. and has left the server.
4. If the action was sent successfully, other members of the server receive:
*** USER ACTION
For a user from another host:
*** USER@HOST ACTION
Example:
> /act is drinking coffee.
*** Alice is drinking coffee.
When a user joins or leaves a server, all other members receive a system notification.
A local user joined:
*** USER has joined the server.
A remote user joined:
*** USER@HOST has joined the server.
A local user left:
*** USER has left the server.
A remote user left:
*** USER@HOST has left the server.
Capabilities are optional protocol extensions loaded by the server. They add extra commands beyond the core DMconnect set. Capability commands use the format /CAPABILITY-COMMAND or /CAPABILITY (without arguments) to show help for that capability.
To get a list of all capabilities available on this server:
/list_capabilities
If capabilities are available, the server responds with:
Capabilities: status, ignore, sessions, http_file_upload. Use /CAPABILITY_NAME for help.
If no capabilities are loaded:
No capabilities available.
To view the commands of a specific capability, send:
/CAPABILITY_NAME
For example:
> /status
/status-check <username> - Check if a user is online or offline
/status-sub-add <username> - Subscribe to status notifications
/status-sub-del <username> - Unsubscribe from status notifications
/status-sub-list - Show your subscription list
/status-sub-clear - Clear your subscription list