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

binary data isn't working #2

Closed
Deins opened this issue Nov 9, 2017 · 3 comments
Closed

binary data isn't working #2

Deins opened this issue Nov 9, 2017 · 3 comments

Comments

@Deins
Copy link

Deins commented Nov 9, 2017

Sending binary data returns client error (chrome) "WebSocket connection to 'ws://127.0.0.1:8008' failed: Could not decode a text frame as UTF-8." How can i force relay to use binary websocket frames?

@isobit
Copy link
Owner

isobit commented Nov 9, 2017

Have you tried setting binaryType = 'arraybuffer' on your WebSocket? I suspect this may be a client-side issue rather than a problem with ws-tcp-relay (it just uses io.Copy).

@Deins
Copy link
Author

Deins commented Nov 9, 2017

Client side sends all data as binary for sure. My suspicion is that tcp-ws side is at fault. As it incorrectly sends binary data as text frame. So browser can't decode it as string. Anyways I switched to https://github.com/herenow/wsProxy and it works without problems.

@isobit
Copy link
Owner

isobit commented Nov 9, 2017

Oh, you're totally right, golang.org/x/net/websocket defaults to sending payloads as text frames (in func (*Conn) Write). I will have to add an option to use binary frames instead.

@isobit isobit closed this as completed in bf07690 Nov 9, 2017
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