Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions textile/features.textile
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ h3(#rest-annotations). RestAnnotations
*** @(RSAN1a1)@ In languages where method overloading is supported, the first argument should also accept a @Message@ object (which must contain a populated @serial@ field)
*** @(RSAN1a2)@ The form of the second argument may accept any language-idiomatic representation (e.g. plain objects in untyped languages), but must allow the user to supply at least the @type@, @clientId@, @name@, @count@, @data@, and @extras@ fields
*** @(RSAN1a3)@ The SDK must validate that the user supplied a @TAN5b@ @type@. (All other fields are optional)
*** @(RSAN1a4)@ The SDK may validate that the total size of the annotation or (if publishing an array) annotations, calculated identically to message size per "TO3l8":#TO3l8, exceeds the @maxMessageSize@, then the client library should reject the publish and indicate an error with code 40009
*** @(RSAN1a4)@ The SDK may validate that the total size of the annotation or (if publishing an array) annotations, calculated identically to message size per "TAN4":#TAN4, exceeds the @maxMessageSize@, then the client library should reject the publish and indicate an error with code 40009
** @(RSAN1c)@ The SDK must POST a request body consisting of an array with one element, which is the annotation to be published
*** @(RSAN1c1)@ The @Annotation.action@ must be set to @ANNOTATION_CREATE@
*** @(RSAN1c2)@ The @Annotation.messageSerial@ must be set to the identifier specified in the first argument to @publish()@
Expand Down Expand Up @@ -1452,8 +1452,10 @@ h4. Message
* @(TM6)@ The size of the @Message@ for "TO3l8":#TO3l8 is calculated as follows:
** @(TM6a)@ The size is the sum of the sizes of the @name@, @data@, @clientId@, and @extras@ properties
** @(TM6b)@ The size of an @Object@ or @Array@ @data@ property is its string length after being JSON-stringified
** @(TM6c)@ The size of a @binary@ @data@ property is its size in bytes (of the actual binary, not the base64 representation, regardless of whether the binary protocol is in use)
** @(TM6f)@ The size of a @string@ @data@ property is its length
** @(TM6c)@ The size of a @binary@ @data@ property is its size in bytes (of the actual binary, not the base64 representation, regardless of whether the binary protocol is in use).
** @(TM6f)@ The size of a @string@ @data@ property is its UTF-8 encoded length in bytes (because of Non-ASCII characters)
Comment thread
sacOO7 marked this conversation as resolved.
Outdated
** @(TM6g)@ The size of a @string@ @name@ property is its length
** @(TM6h)@ The size of a @string@ @clientId@ property is its length
Copy link
Copy Markdown
Member

@SimonWoolf SimonWoolf Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no reason that name, clientId, data, and json-encoded-extras strings should use different calculations for their sizes. If we want to specify "UTF-8 encoded length in bytes" for a string data (which I agree is the correct interpretation, we want to bound the encoded size over the wire), we should use that same wording on the others for consistency.

(if ably-js doesn't do this that's technically a bug, though not one that matters much. if the difference changes the result then it wasn't grossy over the limit and it can just get rejected by the server, shrug)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, then it will be better to be specific for each spec point 👍
I guess we will need to update all string specific spec points.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

** @(TM6d)@ The size of the @extras@ property is the string length of its JSON representation
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have Non-ASCII characters included in extras right

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we definitely can, they can contain arbitrary data, eg in a push payload

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks will update for all string spec points 👍

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

** @(TM6e)@ The size of a @null@ or omitted property is zero
* @(TM7)@ The SDK may expose a series of functions (static factory methods on a Message or otherwise, wherever is language idiomatic; for some languages this might just be types that can be used for type assertions, etc), that take a deserialized @JsonObject@, one of the aggregated summaries for a particular annotation type (that is, a value from the @TM2q@ @summary@ @Dict@), and outputs a strongly-typed summary entry, for ease of use by the end user (particularly in languages where manipulating plain objects is difficult).
Expand Down Expand Up @@ -1628,7 +1630,7 @@ h4. ObjectData
** @(OD3b)@ If set, the size of a @boolean@ property is 1
** @(OD3c)@ If set, the size of a @bytes@ property is its size in bytes (of the actual binary, not the base64 representation, regardless of whether the binary protocol is in use)
** @(OD3d)@ If set, the size of a @number@ property is 8
** @(OD3e)@ If set, the size of a @string@ property is its length
** @(OD3e)@ If set, the size of a @string@ property is its UTF-8 encoded length in bytes (because of Non-ASCII characters)
** @(OD3f)@ The size of a @null@ or omitted property is zero

h4. Annotation
Expand All @@ -1650,6 +1652,7 @@ h4. Annotation
** @(TAN2k)@ @type@ string: a string indicating the type of the annotation, handled opaquely by the SDK
** @(TAN2l)@ @extras@ object (optional): A JSON-encodable object for arbitrary metadata
* @(TAN3)@ @fromEncoded@ and @fromEncodedArray@ are alternative constructors that take an (already deserialized) @Annotation@-like object (or array of such objects), and optionally a @channelOptions@, and return an @Annotation@ (or array of @Annotations@) that's decoded and decrypted analagously to @TM3@ and @TP4@
* @(TAN4)@ The size of the @Annotation@ for "TO3l8":#TO3l8 is calculated in the same way as for @Message@; see "TM6":#TM6

h4. ProtocolMessage

Expand Down
Loading