Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Receive binary Brackets-Node command responses #6339

Merged
merged 2 commits into from
Jan 9, 2014

Conversation

iwehrman
Copy link
Contributor

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.

@ghost ghost assigned jasonsanjose Jan 2, 2014
@jasonsanjose
Copy link
Member

Reviewed. Will merge after the next shell build to make sure the changes are picked up for the next unit test run.

@jasonsanjose
Copy link
Member

Merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants