Skip to content
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

Specifying the 'binaryType' attribute? #18

Closed
METACEO opened this issue Mar 18, 2018 · 3 comments
Closed

Specifying the 'binaryType' attribute? #18

METACEO opened this issue Mar 18, 2018 · 3 comments

Comments

@METACEO
Copy link

METACEO commented Mar 18, 2018

Would a developer be able to specify the binaryType attribute of the websocket?.. such as what's noted in the MDN docs?

Could this be an option or does the developer have access to the native Websocket via sockette?

// Create WebSocket connection.
const socket = new WebSocket('ws://localhost:8080');
socket.binaryType = 'arraybuffer';
@lukeed
Copy link
Owner

lukeed commented Mar 18, 2018

Hey~!

You have access to the underlying WebSocket via event.target on all event listeners. So you can set that attribute within onopen if you want it. I left a tiny example here if you would like a reference. The example was to save a reference to the socket for later use, which may not be necessary in your case.

@METACEO
Copy link
Author

METACEO commented Mar 18, 2018

Ahh, very well!.. I'll include this assignment in the onopen event, thank you!

@METACEO METACEO closed this as completed Mar 18, 2018
@lukeed
Copy link
Owner

lukeed commented Mar 18, 2018

Awesome!

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

No branches or pull requests

2 participants