Created
March 18, 2012 04:22
-
-
Save zao/2068876 to your computer and use it in GitHub Desktop.
TOY protocol description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Messages begin with one octet of message tag. | |
Primitives | |
========== | |
sized-string: one octet of size followed by that many printable low-ascii characters | |
Client -> Server | |
================ | |
0x3F: HELLO | |
Payload: username :: sized-string | |
Meaning: Register connection with human-readable user-name, required to be allowed to send and receive chat. | |
0x3E: I-SAY | |
Payload: chatmessage :: sized-string | |
Meaning: Message to broadcast to everyone, excluding client. | |
Server -> Client | |
================ | |
0x3C: HE-SAID | |
Payload: username :: sized-string | |
chatmessage :: sized-string | |
Meaning: Message from another user. | |
Additional semantics | |
==================== | |
When an user attempts to send a message without being registered, disconnect him. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment