Skip to content

Commit ec36c9b

Browse files
committed
Add spec tags for flags and channel modes for Objects, and for ObjectMessage class
Based on the spec added in [1], and updates to the spec made in [2] and [3] [1] ably/specification#298 [2] ably/specification#327 [3] ably/specification#328
1 parent bfab972 commit ec36c9b

4 files changed

Lines changed: 120 additions & 71 deletions

File tree

src/common/lib/types/protocolmessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class ProtocolMessage {
169169
/**
170170
* This will be undefined if we skipped decoding this property due to user not requesting Objects functionality — see {@link fromDeserialized}
171171
*/
172-
state?: ObjectsPlugin.ObjectMessage[];
172+
state?: ObjectsPlugin.ObjectMessage[]; // TR4r
173173
auth?: unknown;
174174
connectionDetails?: Record<string, unknown>;
175175
params?: Record<string, string>;

src/common/lib/types/protocolmessagecommon.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// constant definitions that can be imported by anyone without worrying about circular
22
// deps
33

4+
// TR2
45
export const actions = {
56
HEARTBEAT: 0,
67
ACK: 1,
@@ -31,6 +32,7 @@ Object.keys(actions).forEach(function (name) {
3132
ActionName[(actions as { [key: string]: number })[name]] = name;
3233
});
3334

35+
// TR3
3436
export const flags: { [key: string]: number } = {
3537
/* Channel attach state flags */
3638
HAS_PRESENCE: 1 << 0,

src/common/lib/util/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ export function inspectBody(body: unknown): string {
285285
* Returns the byte size of the provided data based on the spec:
286286
* - TM6a - size of the string is byte length of the string
287287
* - TM6c - size of the buffer is its size in bytes
288-
* - OD3c - size of a number is 8 bytes
289-
* - OD3d - size of a boolean is 1 byte
288+
* - OD3d - size of a number is 8 bytes
289+
* - OD3b - size of a boolean is 1 byte
290290
*/
291291
export function dataSizeBytes(data: string | number | boolean | Bufferlike): number {
292292
if (Platform.BufferUtils.isBuffer(data)) {

0 commit comments

Comments
 (0)