Skip to content

playground: Send data unmodified via XHR binary mode. #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2015

Conversation

dmitshur
Copy link
Member

We don't want the raw bytes to change from client to server, so send using binary mode.
This is done by using []byte parameter, which gets externalized into Uint8Array aka ArrayBufferView, which is one of the parameters that XHR send accepts for sending binary data.

This is based on my newfound understanding of ArrayBufferView from discussion at gopherjs/gopherjs@59323cd#commitcomment-9452804. @neelance, I'd like for you to confirm my understanding is correct before merging this.

If everything checks out, the XHR package docs should be updated to include that []byte is a valid input type for binary transfer.

Finally, the .go file needs to be built and likely the entire playground updated via update.sh since there've been changes to GopherJS compiler.

Tasks before merging

@dmitshur
Copy link
Member Author

Task 1 is done in gopherjs/gopherjs#167.

Creating issue for task 2, made dominikh/go-js-xhr#4.

We don't want the raw bytes to change from client to server, so send
using binary mode.
This is done by using []byte parameter, which gets externalized into
Uint8Array aka ArrayBufferView, which is one of the parameters that XHR
send accepts for sending binary data.
See dominikh/go-js-xhr#4 for details.
@dmitshur dmitshur force-pushed the playground-send-xhr-binary-data branch from 98fc908 to f033e2e Compare January 28, 2015 02:41
@dmitshur
Copy link
Member Author

All 3 tasks done, this PR is ready to be merged.

@dmitshur
Copy link
Member Author

On second thought, there are improvements to xhr package forthcoming in dominikh/go-js-xhr#6, so let's hold off from merging this PR until then. The upstream API improvements will supersede the current change in this PR, allowing a further simplification of code.

@dmitshur
Copy link
Member Author

dmitshur commented Feb 1, 2015

Okay, I will merge this as is now because this PR fixes a production issue/task. Code refactoring can be done separately in a followup PR, as it's still ongoing research as to what the best library/API to use.

dmitshur added a commit that referenced this pull request Feb 1, 2015
playground: Send data unmodified via XHR binary mode.
@dmitshur dmitshur merged commit 26bdaac into master Feb 1, 2015
@dmitshur dmitshur deleted the playground-send-xhr-binary-data branch February 1, 2015 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant