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: No way to manage connection outside of handler #5959

Closed
lukescott opened this issue Jul 25, 2013 · 5 comments
Closed

x/net/websocket: No way to manage connection outside of handler #5959

lukescott opened this issue Jul 25, 2013 · 5 comments
Milestone

Comments

@lukescott
Copy link

@lukescott lukescott commented Jul 25, 2013

Currently there is no way to get a websocket.Conn object without leaving the handler, or
without having a handler at all. I need to wrap the websocket.Conn object for another
library, but not without maintaing a blocked go routine.

I suggest adding this method:

func (s Server) Upgrade(w http.ResponseWriter, req *http.Request) (conn *Conn, err
error) {
    var rwc net.Conn
    var buf *bufio.ReadWriter
    if rwc, buf, err = w.(http.Hijacker).Hijack(); err != nil {
        return nil, err
    }
    conn, err = newServerConn(rwc, buf, req, &s.Config, s.Handshake);
    return
}
@robpike
Copy link
Contributor

@robpike robpike commented Aug 4, 2013

Comment 1:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc
Copy link
Contributor

@rsc rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-net.

@mikioh mikioh changed the title go.net/websocket: No way to manage connection outside of handler x/net/websocket: No way to manage connection outside of handler Dec 23, 2014
@mikioh mikioh added repo-net and removed repo-net labels Dec 23, 2014
@mikioh mikioh changed the title x/net/websocket: No way to manage connection outside of handler websocket: No way to manage connection outside of handler Jan 4, 2015
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title websocket: No way to manage connection outside of handler x/net/websocket: No way to manage connection outside of handler Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-net label Apr 14, 2015
@odeke-em
Copy link
Member

@odeke-em odeke-em commented Jun 6, 2020

Thank you @lukescott for having filed this issue, for the patience, and for using Go. Unfortunately we no longer maintain x/net/websocket and instead recommend using libraries

I shall close this issue.

@odeke-em odeke-em closed this Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.