Guns Lobby Protocol
From NarcWiki
The lobby protocol is transported via TCP, so it's a reliable stream of data. The Edicomm base protocol may be occasionally relaxed for certain data transmission (e.g. tank shapes, map data).
Contents |
Common Messages
These can be sent by either client or server, as needed.
Ping/pong: lag test
LAG [identifier]
A lag-test message requires that the receiving party (server or client) respond immediately to the sender with a LAG message of the same identifier. The identifier can be any string of reasonable length (recommend 2-4 chars for normal use). The sender can use the duration between sending original message and receiving reply to determine a reasonable round-trip time.
Implementation detail: The server may use this to poke at a client that hasn't sent any updates in a while.
Client to Server
Username change
USN <new username>
Self-explanatory. See also S2C nick change notification.
Chat to everyone
MSG <text>
Asks the server to relay a chat message on the current user's behalf. The server has an equivalent message that includes information on which client sent the chat message.
Chat to team members
MST <text>
Asks the server to relay a chat message only to the sender's team. The server has an equivalent message that includes information on which client sent the chat message.
Disconnect notification
USD [optional reason]
The client should notify the server when it intends to disconnect by sending this message. The client can optionally include a reason for disconnecting, which will be sent by the server to remaining players using the appropriate server-to-client message.
Server to Client
Global chat
MSG <user-id> <text>
This is the S2C version of the global chat C2S command. Note that this includes the user ID of the person messaging.
Team chat
MST <user-id> <text>
Another S2C version of an existing C2S command.
Name change notification
USN <user-id> <username>
This is sent to all clients when a player changes their nickname, as well as when they send their nickname in the first place. See also C2S username change.
Player disconnect notification
USD <user-id> [reason]
Sent to all but the departing client when a client announces its (duh?) imminent disconnection. The optional reason may be set by the client, or the server can fill in if necessary (e.g. USD 5 Connection lost and no reconnect for 30 seconds).