examples/chat: Rewrite in PDL
This commit is contained in:
48
examples/chat/protocol.pdl
Normal file
48
examples/chat/protocol.pdl
Normal file
@@ -0,0 +1,48 @@
|
||||
// Error is sent by a party when the other party has done something erroneous. The
|
||||
// valid error codes are:
|
||||
//
|
||||
// - 0: General, unspecified error
|
||||
//
|
||||
// The description field, if specified, determines a human-readable error to be
|
||||
// shown to the user. The sending party must immediately close the transaction
|
||||
// after this message is sent.
|
||||
M0000 Error {
|
||||
0000 Code U16,
|
||||
0001 Description ?String,
|
||||
}
|
||||
|
||||
// Success is sent by a party when it has successfully completed a task given to it
|
||||
// by the other party. The sending party must immediately close the transaction
|
||||
// after this message is sent.
|
||||
M0001 Success {
|
||||
|
||||
}
|
||||
|
||||
// Join is sent by the client when it wishes to join a room. It must begin a new
|
||||
// transaction, and that transaction will persist while the user is in that room.
|
||||
// Messages having to do with the room will be sent along this transaction. To
|
||||
// leave the room, the client must close the transaction.
|
||||
M0200 Join {
|
||||
0000 Room String,
|
||||
0001 Nickname String,
|
||||
}
|
||||
|
||||
// Chat is sent by the client when it wishes to post a message to the room. It is
|
||||
// also relayed by the server to other clients to notify them of the message. It
|
||||
// must be sent within a room transaction.
|
||||
M0300 Chat {
|
||||
0000 Content String,
|
||||
0001 Nickname ?String,
|
||||
}
|
||||
|
||||
// JoinNotify is sent by the server when another client joins the room. It must be
|
||||
// sent within a room transaction.
|
||||
M0400 JoinNotify {
|
||||
0000 Nickname String,
|
||||
}
|
||||
|
||||
// LeaveNotify is sent by the server when another client leaves the room. It must
|
||||
// be sent within a room transaction.
|
||||
M0401 LeaveNotify {
|
||||
0000 Nickname String,
|
||||
}
|
||||
Reference in New Issue
Block a user