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

Set binaryType #16

Closed
AmazingTurtle opened this issue Oct 26, 2019 · 3 comments
Closed

Set binaryType #16

AmazingTurtle opened this issue Oct 26, 2019 · 3 comments

Comments

@AmazingTurtle
Copy link

It is not possible to set binaryType for a websocket object.
It would be good to have a feature that allows to set a value for this.

@robtaussig
Copy link
Owner

Great suggestion and apologies for the delay in response. I've been thinking of working on an option that gives a little direct access to the websocket (that in this case would allow you to set binaryType), but I'm also concerned about a case in which the websocket is being shared across multiple components and one mutates it in a way that breaks everything else.

Of course, I can also just accept an option to set the binaryType when creating the websocket, and if it's a shared websocket, an error will be thrown if future subscribers try to set it to a binaryType other than what the original is. I'll think about it tonight and let you know!

@robtaussig
Copy link
Owner

@AmazingTurtle

I put together a branch that I think will accomplish this. An example of the API/functionality can be seen here:

https://github.com/robtaussig/react-use-websocket/blob/socket_proxy/README.md#getwebsocket-function---proxy

What do you think?

@robtaussig
Copy link
Owner

I'm going to go ahead and close this thread and promote this change.

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