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: messages not exposed in package API #7632

Open
gopherbot opened this issue Mar 25, 2014 · 4 comments

Comments

@gopherbot
Copy link

commented Mar 25, 2014

by lorresylvan@yahoo.com:

WebSocket peers exchange messages. A message is composed of one or more frames.

The (*Conn).Read and (Codec).Receive methods return a single frame. There is no
mechanism to detect message boundaries or otherwise compose frames into a message.

To use this package, an application must provide its own framing or assume that the peer
sends single frame messages. My guess is that most applications assume that the peer
sends single frame messages because that's what browsers and the websocket package do.
This assumption is not true of all peers.
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented May 9, 2014

Comment 1:

Labels changed: added repo-net, release-none.

@gopherbot

This comment has been minimized.

Copy link
Author

commented Oct 9, 2014

Comment 2 by albert.jin:

Why has this still not been accepted? The new Chrome 38 with its WebSocket
implementation that does actually send multiple-frame messages. The max frame size is
possibly 131072 bytes.

@gopherbot gopherbot added new labels Oct 9, 2014

@bradfitz bradfitz removed the new label Dec 18, 2014

@mikioh mikioh changed the title go.net/websocket: messages not exposed in package API x/net/websocket: messages not exposed in package API Dec 23, 2014

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

@mikioh mikioh changed the title x/net/websocket: messages not exposed in package API websocket: messages not exposed in package API Jan 4, 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: messages not exposed in package API x/net/websocket: messages not exposed in package API Apr 14, 2015

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

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

@gdamore

This comment has been minimized.

Copy link

commented Dec 20, 2017

This is fairly fatal. RFC 6455 is fairly specific that implementations must NOT be sensitive to frame boundaries, as proxies are permitted to break content up into separate frames if they so desire. I've no great love of WebSocket in general, but this failing means that the golang x/net implementation is worthless to me.

@cespare

This comment has been minimized.

Copy link
Contributor

commented Dec 20, 2017

This is the main reason why github.com/gorilla/websocket is what most folks recommend for websockets, not the x/net implementation. Even the x/net/websocket docs say at the top:

This package currently lacks some features found in an alternative and more actively maintained WebSocket package:

https://godoc.org/github.com/gorilla/websocket

There have been various discussions over the years about fixing the x/net API or bringing gorilla/websocket into x/net or something else, but they never really panned out.

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