Communication Protocols

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another member of the Core Development Team before making changes.

Summary

Technical Notes

  • Empty spaces in front of messages are to be ignored.
  • A message must end with a New Line character (\n)
  • Clients should NOT expect that only this number of parameters are to be given at all times.
  • Clients should be able to add more parameters than expected even if they are not parsed. This will guarantee that old clients don't break in case extensions to the protocol are made. New parameters not included in this edition of the protocol are to be added to the end of the parameters list.
  • Message Tokens are command abbreviations used so that the server doesn't have to send explicit commands and save some bandwidth. This has been proved to be useful in IRC with thousands of clients connected. I believed we should take advantage of this.
  • If a parameter has more than one word in it then it should be enclosed within quotation marks (””).

Notes about this document

Fields within <> are Mandatory.
Fields within [] are Optional.

Miragroupware Client<->Server Protocol Tokens

Message Token Sender
ERROR E Server
New User NU Client
User Accepted UA Server
List Utilities LU Client
List Workplaces LW Client
List Members LM Client
LOGIN L Client
LOGOUT LO Client
Login Success LS Server
Message M BOTH
New Member NM Server
Private Message PM BOTH
Part Group PG Client
New Group NG Client
Group Accepted GA Server
Group G Server
Group Parted GP Server
Join Group JG Client
Group Joined GJ Server
User U Server
Utility UT BOTH
Query Q Client
PING PI BOTH
PONG PO BOTH
Utility List UL Server
Workplace List WL Server
Workplace Desc. WD Server

Error Message (Token E)

An error message from the server to a Client.

E <Command> [Message]

Example: [Server] E N “Bad User”

NOTES: Error message should try to be as generic as possible so that error message handling can be done at the client level.

New Client (Token NU)

Attempt to create a new client.

NU <username> <eMail> <password> <FirstName> [LastName]
Server responds with
UA <UserID> <username>

Example: [Client] NU clsk alan.alvarez@us.army.mil encryptedPass Alan Alvarez
[Server] UA 283 clsk

NOTES: It'll be optional to let anyone create a new account or let only the Server admin or Group Managers to create a new accountd.
This should be an option in mira-server.conf
Also, note that the UserID is generated by the server.

List Members (Token LM)

This token is used by the client to ask the list of members in a workplace
LM <workplace>

The server would then respond with a ML message

ML <workplace> username1:n,username2:f

List Utilities (Token LU)

This token is used by the client to ask the list of utilities in a workplace
LU <workplace>

The server would then respond with a UL message

UL <workplace> Utility1,Utilit2

List Workplaces (Token LW)

This token is used by the client to ask for a list of the workplaces it belongs to
LW

The server would then respond with a WL message

WL id:workplacename1,id:workplacename2

Login (Token L)

Attempt to login to the server.

L <username> <password>
Server responds with
LS

Example: [Client] L clsk EncryptedPass
[Server] LS

Log out (Token LO)

A client letting know the server that it is logging out, and closing the connection.

LO

Message (Token M)

A user sending a Message to a group

[Client] M <GroupName> <Message>
Server sends message
[Server] M <username> <GroupName> <Message> <TimeStamp>

Example: [Client] M Mira “Welcome to Group Mira” [Server] M clsk Mira “Welcome to Group Mira” 7898547

New Member (Token NM)

This message is used by the server to let clients know that a client has joined a Workplace.

[Server] NM <username> <"Workplace">

Private Message (Token PM)

A user sending a message to another user.

[Client] PM <username> <Message>
Server sends message
[Server] PM <sender username> <reciever username> <Message> <TimeStamp>

Example: [Client] PM J_K9 “Hello J_K9, this is clsk”\n
[Server] PM clsk J_K9 “Hello J_K9, this is clsk” 75654198

Part Workplace (Token PG)

A client asking to leave a workplace

[Client] PG <workplace>
Server responds with:
[Server] GP <username> <workplace>

Note: Server will respond with WP to all workplace members.

New Group (Token NG)

A user trying to create a new group.

NG <GroupName> <GroupOwner>
Server responds with:
GA <GroupName>

Example: [Client] NG Mira clsk
[Server] GA Mira

Group Description (Token G)

A server describing a group to a user.

G <GroupName> <GroupMembers>

Example: [Server] G Mira clsk,J_K9,beyonddc

NOTES: GroupMembers is a comma-separated list of usernames in that group.
Examples of times where this message would be sent are: When a user logs in to the server, when an user joins a group .

Group Parted (Token GP)

A server responding to a PW message from a user

[Client] PG <workplace>
Server responds with:
[Server] GP <username> <workplace>

Note: Server will respond with GP to all workplace members.

Join Group (Token JG)

A user trying to join a new group

JG <GroupName> [InvitationID]

NOTES: Invitation IDs are to be passed whenever possible as this should make the process of finding the ID faster. If not the server would have to find a matching invitation for the user to that specific group in its invitation table.
Some groups might be able to be joined without invitations. This is up to the Group Manager and is a Group configuration.
If a user successfully joins a group, a server responds with a Group description message.

Group Joined (Token GJ)

This is the response given by a Mira server to a successful JG message.

GJ <GroupName>

User Description (Token U)

A server describing an User to another User

U <username> [eMail] [FirstName] [LastName] [GroupIDs] [...]

Example: [Server] clsk alan.alvarez@us.army.mil Alan Alvarez Mira,Group2

NOTES: How much data is sent depends on how much data the user wants other people to be able to see.
This is a message that will probably be highly modified throughout time.

Utility Message (Token UT)

This token is used for Utility communication between the client and the server.
This is not used for inter-utility communication
ie: A file utility communication with its counterpart on the server.

UT <utility> <workplace> <...>

Example: [Client] UT Files “Blues Project” CREATE document.txt
[Server] UT Files “Blues Project” CREATED document.txt 1230394

Query (Token Q)

A user trying to find out information about another User or Group.

Q <USERS|GROUPS> <Field1,Field2,Field3,...|*> [Field1=Value1,Field2=Value2,Field3=Value3,etc...]

Example: [Client] Q USERS * FirstName=Alan,LastName=Alvarez
Server responds with a User or Group Description returning only those fields specified in parameter 2.
If * is specified all fields will be sent back.

If no Field=Value is passed then the server will show all users or groups.

PING (Token PI)

A Client OR Server checking for response.

PI <ID>
The other end responds with a PONG (PO) message using the same ID
PO <ID>

Example: [Server] PI 25
[Client] PO 25

PING (Token PI)

A Client OR Server checking for response.

PI <ID>
The other end responds with a PONG (PO) message using the same ID
PO <ID>

Example: [Server] PI 25
[Client] PO 25

Utility List (Token UL)

This token is used by the server in response to a LU message from a client.
It lists all the utilities in a workplace

UL <workplace> [Utility1],[Utility2],[...]

Note that utilities are separated by commas.

Workplace List (Token WL)

This token is used by the server in response to a LW message from a client

WL [id:workplacename1],[id:workplacename2],[...]

Workplace Description (Token WD)

This token is used by the server to send clients a workplace's description.

WD <Workplace Name> <Workplace Description>

Note: In the Mira client and server implementation, this message is automatically sent to the client when requesting the workplace's utility list (WL).

Example Conversation

This is how a normal conversation should look like:

[Client] NU clsk alan.alvarez@us.army.mil EncryptedPass Alan Alvarez
[Server] UA clsk
[Client] L clsk EncryptedPass
[Server] LS
[Client] NG Mira
[Server] GA Mira
[Client] Q GROUPS * GroupName=Mira
[Server] G Mira clsk,J_K9,
[Client] M clsk "Welcome to Group Mira"
[Server] M clsk Mira "Welcome to Group Mira" 7898547
[Server] T SomeServerToken147 SomeClientToken258
[Client] PI foo
[Server] PO foo

Discussion

Alan Alvarez, 2008/08/26 05:58

This protocol is in the process of being changed to add User IDs.
Users and WorkPlaces are now tracked by user ids instead of usernames.

sibte, 2009/05/22 17:33

Alan,

Do you think it would make sense to abbrevivate options in messages as well?

For example, instead of

Q GROUPS * GroupName=Mira

We can have

Q G * N=Mira

Similarly to query users we can have

Q U * N=foo

Using this scheme we may be able to save some additional bandwidth as well.

Alan Alvarez, 2009/10/15 18:22

I'm sorry I just saw this. Yes, this makes sense.

 
development/blueprints/net_protocols.txt · Last modified: 2011/04/19 13:18 by clsk
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki