@@ -125,217 +125,279 @@ MessagePack uses different formats to encode values. Refer to the [MessagePack F
125125### HandshakeRequest Message
126126` HandshakeRequest ` messages have the following structure.
127127```
128- [1, Version]
128+ [1, Version, ConnectionType, Target, MigrationLevel?, ExtensibleMembers?, AllowStatefulReconnects? ]
129129```
130130- 1 - Message Type, indicating this is a ` HandshakeRequest ` message.
131- - Version - A ` Int32 ` encoding number of the protocol version.
132- - ConnectionType - A ` Int32 ` encoding number of the connection type.
131+ - Version - An ` Int32 ` encoding number of the protocol version.
132+ - ConnectionType - An ` Int32 ` encoding number of the connection type.
133133 - 0, Default, it can carry clients, service runtime should always accept this kind of connection.
134134 - 1, OnDemand, creating when service requested more connections, it can carry clients, but it may be rejected by service runtime.
135135 - 2, Weak, it can not carry clients, but it can send message.
136- - MigrationLevel - A ` Int32 ` encoding number indicates if further client connections associated with this server connection could be migrated.
136+ - Target - A ` String ` indicates the target service.
137+ - MigrationLevel (Optional) - An ` Int32 ` encoding number indicates if further client connections associated with this server connection could be migrated.
137138 - 0, Off, a client connection can not be migrated to another server.
138139 - 1, ShutdownOnly, a client connection can be migrated only if the matched server was shutdown gracefully.
139140 - 2, Any, a client connection can be migrated even if the matched server connection was dropped accidentally. (may cause data loss)
141+ - ExtensibleMembers (Optional) - A MessagePack Map indicates the extensible members.
142+ - AllowStatefulReconnects (Optional) - A ` Boolean ` indicates the app server allows stateful reconnects or not.
140143
141144#### Example: TODO
142145
143146### HandshakeResponse Message
144147` HandshakeResponse ` messages have the following structure.
145148```
146- [2, ErrorMessage]
149+ [2, ErrorMessage, ExtensionMembers?, ConnectionId? ]
147150```
148151- 2 - Message Type, indicating this is a ` HandshakeResponse ` message.
149152- ErrorMessage - A ` String ` encoding error message. Null means handshake success, otherwise it means there is error.
153+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
154+ - ConnectionId (Optional) - A ` String ` for the connection id of current server connection.
150155
151156#### Example: TODO
152157
153158### Ping Message
154159 ` Ping ` messages have the following structure.
155160```
156- [3, Messages]
161+ [3, Messages? ]
157162```
158163- 3 - Message Type, indicating this is a ` Ping ` message.
159- - Messages - An ` Array ` of ` String ` indicates ` Ping ` message type and value.
164+ - Messages (Optional) - An ` Array ` of ` String ` indicates ` Ping ` message type and value.
160165
161166#### Example: TODO
162167
163168### OpenConnection Message
164169` OpenConnection ` messages have the following structure.
165170```
166- [4, ConnectionId, Claims]
171+ [4, ConnectionId, Claims, Headers?, ExtensionMembers? ]
167172```
168173- 4 - Message Type, indicating this is a ` OpenConnection ` message.
169174- ConnectionId - A ` String ` encoding unique Id for the connection.
170175- Claims - A MessagePack Map containing all claims of this client.
176+ - Headers (Optional) - A MessagePack Map containing all headers of this client.
177+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
171178
172179#### Example: TODO
173180
174181### CloseConnection Message
175182` CloseConnection ` messages have the following structure.
176183```
177- [5, ConnectionId, ErrorMessage]
184+ [5, ConnectionId, ErrorMessage, Headers?, ExtensionMembers? ]
178185```
179186- 5 - Message Type, indicating this is a ` CloseConnection ` message.
180187- ConnectionId - A ` String ` encoding unique Id of the connection.
181- - ErrorMessage - Optional ` String ` encoding error message.
188+ - ErrorMessage - A ` String ` encoding error message.
189+ - Headers (Optional) - A MessagePack Map containing all headers of this client.
190+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
182191
183192#### Example: TODO
184193
185194### ConnectionData Message
186195` ConnectionData ` messages have the following structure.
187196```
188- [6, ConnectionId, Payload]
197+ [6, ConnectionId, Payload, ExtensionMembers? ]
189198```
190199- 6 - Message Type, indicating this is a ` ConnectionData ` message.
191200- ConnectionId - A ` String ` encoding unique Id for the connection.
192201- Payload - ` Binary ` encoding of the raw bytes from/to the connection.
202+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
193203
194204#### Example: TODO
195205
196206### MultiConnectionData Message
197207` MultiConnectionData ` messages have the following structure.
198208```
199- [7, ConnectionList, Payloads]
209+ [7, ConnectionList, Payloads, ExtensionMembers? ]
200210```
201211- 7 - Message Type, indicating this is a ` MultiConnectionData ` message.
202212- ConnectionList - An array containing ` String ` encoding Ids of the target connections.
203213- Payloads - A MessagePack Map containing payloads, with string keys and byte array values. The key is the protocol name of the value.
214+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
204215
205216#### Example: TODO
206217
207218### UserData Message
208219` UserData ` messages have the following structure.
209220```
210- [8, UserId, Payloads]
221+ [8, UserId, Payloads, ExtensionMembers? ]
211222```
212223- 8 - Message Type, indicating this is a ` UserData ` message.
213224- UserId - A ` String ` encoding unique Id for the user.
214225- Payloads - A MessagePack Map containing payloads, with string keys and byte array values. The key is the protocol name of the value.
226+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
215227
216228#### Example: TODO
217229
218230### MultiUserData Message
219231` MultiUserData ` messages have the following structure.
220232```
221- [9, UserList, Payloads]
233+ [9, UserList, Payloads, ExtensionMembers? ]
222234```
223235- 9 - Message Type, indicating this is a ` MultiUserData ` message.
224236- UserList - An array containing ` String ` encoding Ids of the target users.
225237- Payloads - A MessagePack Map containing payloads, with string keys and byte array values. The key is the protocol name of the value.
238+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
226239
227240#### Example: TODO
228241
229242### BroadcastData Message
230243` BroadcastData ` messages have the following structure.
231244```
232- [10, ExcludedList, Payloads]
245+ [10, ExcludedList, Payloads, ExtensionMembers? ]
233246```
234247- 10 - Message Type, indicating this is a ` BroadcastData ` message.
235248- ExcludedList - An array containing ` String ` encoding Ids of the connections, which will not receive payload in this message.
236249- Payloads - A MessagePack Map containing payloads, with string keys and byte array values. The key is the protocol name of the value.
250+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
237251
238252#### Example: TODO
239253
240254### JoinGroup Message
241255` JoinGroup ` messages have the following structure.
242256```
243- [11, ConnectionId, GroupName]
257+ [11, ConnectionId, GroupName, ExtensionMembers? ]
244258```
245259- 11 - Message Type, indicating this is a ` JoinGroup ` message.
246260- ConnectionId - A ` String ` encoding unique Id for the connection.
247261- GroupName - A ` String ` encoding group name, which the connection will join.
262+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
248263
249264#### Example: TODO
250265
251266### LeaveGroup Message
252267` LeaveGroup ` messages have the following structure.
253268```
254- [12, ConnectionId, GroupName]
269+ [12, ConnectionId, GroupName, ExtensionMembers? ]
255270```
256271- 12 - Message Type, indicating this is a ` LeaveGroup ` message.
257272- ConnectionId - A ` String ` encoding unique Id for the connection.
258273- GroupName - A ` String ` encoding group name, which the connection will leave.
274+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
259275
260276#### Example: TODO
261277
262278### GroupBroadcastData Message
263279` GroupBroadcastData ` messages have the following structure.
264280```
265- [13, GroupName, ExcludedList, Payloads]
281+ [13, GroupName, ExcludedList, Payloads, ExtensionMembers?, ExcludedUserList?, CallerUserId? ]
266282```
267283- 13 - Message Type, indicating this is a ` GroupBroadcastData ` message.
268284- GroupName - A ` String ` encoding target group name.
269285- ExcludedList - An array containing ` String ` encoding Ids of the connections, which will not receive payload in this message.
270286- Payloads - A MessagePack Map containing payloads, with string keys and byte array values. The key is the protocol name of the value.
287+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
288+ - ExcludedUserList (Optional) - An array containing ` String ` encoding Ids of the users, which will not receive payload in this message.
289+ - CallerUserId (Optional) - A ` String ` encoding the caller user id.
271290
272291#### Example: TODO
273292
274293### MultiGroupBroadcastData Message
275294` MultiGroupBroadcastData ` messages have the following structure.
276295```
277- [14, GroupList, Payloads]
296+ [14, GroupList, Payloads, ExtensionMembers? ]
278297```
279298- 14 - Message Type, indicating this is a ` MultiGroupBroadcastData ` message.
280299- GroupList - An array containing ` String ` encoding target group names.
281300- Payloads - A MessagePack Map containing payloads, with string keys and byte array values. The key is the protocol name of the value.
301+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
282302
283303#### Example: TODO
284304
285305### UserJoinGroup Message
286306` UserJoinGroup ` messages have the following structure.
287307```
288- [16, UserId, GroupName]
308+ [16, UserId, GroupName, ExtensionMembers? ]
289309```
290310- 16 - Message Type, indicating this is a ` UserJoinGroup ` message.
291311- UserId - A ` String ` encoding unique Id for the user.
292312- GroupName - A ` String ` encoding group name, which the user will join.
313+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
293314
294315#### Example: TODO
295316
296317### UserLeaveGroup Message
297318` UserLeaveGroup ` messages have the following structure.
298319```
299- [17, UserId, GroupName]
320+ [17, UserId, GroupName, ExtensionMembers? ]
300321```
301322- 17 - Message Type, indicating this is a ` UserLeaveGroup ` message.
302323- UserId - A ` String ` encoding unique Id for the user.
303324- GroupName - A ` String ` encoding group name, which the user will leave.
325+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
304326
305327#### Example: TODO
306328
307329### JoinGroupWithAck Message
308330` JoinGroupWithAck ` messages have the following structure.
309331```
310- [18, ConnectionId, GroupName, AckId]
332+ [18, ConnectionId, GroupName, AckId, ExtensionMembers? ]
311333```
312334- 18 - Message Type, indicating this is a ` JoinGroupWithAck ` message.
313335- ConnectionId - A ` String ` encoding unique Id for the connection.
314336- GroupName - A ` String ` encoding group name, which the connection will join.
315- - AckId - A ` Int32 ` encoding Id number to identify the corresponding ack message.
337+ - AckId - An ` Int32 ` encoding Id number to identify the corresponding ack message.
338+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
316339
317340#### Example: TODO
318341
319342### LeaveGroupWithAck Message
320343` LeaveGroupWithAck ` messages have the following structure.
321344```
322- [19, ConnectionId, GroupName, AckId]
345+ [19, ConnectionId, GroupName, AckId, ExtensionMembers? ]
323346```
324347- 19 - Message Type, indicating this is a ` LeaveGroupWithAck ` message.
325348- ConnectionId - A ` String ` encoding unique Id for the connection.
326349- GroupName - A ` String ` encoding group name, which the connection will leave.
327- - AckId - A ` Int32 ` encoding Id number to identify the corresponding ack message.
350+ - AckId - An ` Int32 ` encoding Id number to identify the corresponding ack message.
351+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
328352
329353#### Example: TODO
330354
331355### Ack Message
332356` Ack ` messages have the following structure.
333357```
334- [20, AckId, Status, Message]
358+ [20, AckId, Status, Message, ExtensionMembers?, Payload? ]
335359```
336- - 20 - Message Type, indicating this is a ` Ack ` message.
360+ - 20 - Message Type, indicating this is an ` Ack ` message.
337361- AckId - A ` Int32 ` encoding Id number to associate the corresponding message.
338362- Status - A ` Int32 ` encoding status code to indicate the operation result.
339363- Message - A ` String ` encoding ack message to explain status details.
364+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
365+ - Payload (Optional) - A ` Binary ` encoding the payload to ack.
366+
367+ #### Example: TODO
368+
369+ ### CheckUserInGroupWithAck Message
370+ ` CheckUserInGroupWithAck ` messages have the following structure.
371+ ```
372+ [21, UserId, GroupName, AckId, ExtensionMembers?]
373+ ```
374+ - 21 - Message Type, indicating this is a ` CheckUserInGroupWithAck ` message.
375+ - UserId - A ` String ` encoding unique Id for the user.
376+ - GroupName - A ` String ` encoding group name.
377+ - AckId - An ` Int32 ` encoding Id number to associate the corresponding message.
378+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
379+
380+ #### Example: TODO
381+
382+ ### ServiceEvent Message
383+ ` ServiceEvent ` messages have the following structure.
384+ ```
385+ [22, Type, Id, Kind, Message, ExtensionMembers?]
386+ ```
387+ - 22 - Message Type, indicating this is a ` ServiceEvent ` message.
388+ - Type - An ` Int32 ` indicats the object of event.
389+ - 0, ServiceInstance events
390+ - 1, Connection events
391+ - 2, User events
392+ - 3, Group events
393+ - 4, ServerConnection events
394+ - Id - A ` String ` encoding id for ServiceInstance/Connection/User/Group/ServerConnection.
395+ - Kind - An ` Int32 ` indicats the kind of event.
396+ - 0, Reloading events. For example, the service is about to reloading.
397+ - 1, Invalid events. For example, the connection id is invalid.
398+ - 2, Not existed events. For example, the group is empty.
399+ - 3, Buffer full events. For example, the server connection is sending too many messages, service buffer is full.
400+ - Message - A ` String ` encoding the detail message for the event.
401+ - ExtensionMembers (Optional) - A MessagePack Map indicates the extensible members.
340402
341403#### Example: TODO
0 commit comments