You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request updates NodeConnection so that it can receive binary responses to commands in Node domains. When a binary message --- i.e., an ArrayBuffer instance; i.e., an array of bytes; i.e., not a string to be interpreted as JSON --- is received via the WebSocket, the first four bytes are assumed to be a header and are interpreted as a (32-bit unsigned integer) command ID. The header is then stripped off and the pending deferred of the corresponding command is resolved with the remaining bytes. Clients can then interpret or process the bytes arbitrarily.
To ensure that the command ID can always be encoded as a 32-bit unsigned integer, IDs are now restricted to the range 0 <= id < 2^32. When the maximum value is eclipsed, the counter just rolls back to 0. (This could be improved, but the bugs in this PR already exist in the current implementation, so I'm not too worried about it.)
This should be reviewed in tandem with a companion brackets-shell pull request, adobe/brackets-shell#406, which allows domain commands to return binary responses.
Issue by iwehrman
Monday Dec 30, 2013 at 23:37 GMT
Originally opened as adobe/brackets#6339
This pull request updates
NodeConnection
so that it can receive binary responses to commands in Node domains. When a binary message --- i.e., anArrayBuffer
instance; i.e., an array of bytes; i.e., not a string to be interpreted as JSON --- is received via the WebSocket, the first four bytes are assumed to be a header and are interpreted as a (32-bit unsigned integer) command ID. The header is then stripped off and the pending deferred of the corresponding command is resolved with the remaining bytes. Clients can then interpret or process the bytes arbitrarily.To ensure that the command ID can always be encoded as a 32-bit unsigned integer, IDs are now restricted to the range
0 <= id < 2^32
. When the maximum value is eclipsed, the counter just rolls back to 0. (This could be improved, but the bugs in this PR already exist in the current implementation, so I'm not too worried about it.)This should be reviewed in tandem with a companion brackets-shell pull request, adobe/brackets-shell#406, which allows domain commands to return binary responses.
iwehrman included the following code: https://github.com/adobe/brackets/pull/6339/commits
The text was updated successfully, but these errors were encountered: