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

x/net/websocket: setting BinaryFrame #7350

Open
gopherbot opened this issue Feb 18, 2014 · 4 comments

Comments

@gopherbot
Copy link

commented Feb 18, 2014

by errordeveloper:

Default PayloadType is TextFrame and there seem to be no way of setting it to
BinaryFrame.

https://code.google.com/p/go/source/browse/websocket/hybi.go?repo=net#346

I'm not too sure what the fix would be, but in my case modifying that line 346 worked...
@gopherbot

This comment has been minimized.

Copy link
Author

commented Feb 25, 2014

Comment 1 by ledangster:

If your handler uses *websocket.Conn directly then you directly change PayloadType
(since it's publicly modifiable) to websocket.BinaryFrame before writing out the
frame(s):
 conn.PayloadType = websocket.BinaryFrame
 ...
 conn.Write(...)
@gopherbot

This comment has been minimized.

Copy link
Author

commented Feb 25, 2014

Comment 2 by errordeveloper:

That worked, pardon for newbie bug report. Perhaps I could suggest it needs
to be a little more clear in the docs.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Mar 3, 2014

Comment 3:

Labels changed: added repo-net.

@gopherbot gopherbot added new labels Mar 3, 2014

@bradfitz bradfitz removed the new label Dec 18, 2014

@mikioh mikioh changed the title go.net/websocket: setting BinaryFrame x/net/websocket: setting BinaryFrame Dec 23, 2014

@mikioh mikioh added repo-net and removed repo-net labels Dec 23, 2014

@mikioh mikioh changed the title x/net/websocket: setting BinaryFrame websocket: setting BinaryFrame Jan 4, 2015

@dmitshur

This comment has been minimized.

Copy link
Member

commented Mar 1, 2015

PayloadType is an exported field. It should be documented.

Also, Write should probably mention that it uses the value of PayloadType. Its documentation currently says nothing about that.

dmitshur referenced this issue in shurcooL/play Mar 1, 2015

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed the release-none label Apr 10, 2015

@rsc rsc changed the title websocket: setting BinaryFrame x/net/websocket: setting BinaryFrame Apr 14, 2015

@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015

@rsc rsc removed the repo-net label Apr 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.