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: Dial doesn't use parameter "protocol" #4157

gopherbot opened this issue Sep 26, 2012 · 3 comments

x/net/websocket: Dial doesn't use parameter "protocol" #4157

gopherbot opened this issue Sep 26, 2012 · 3 comments


Copy link

@gopherbot gopherbot commented Sep 26, 2012

by chris.morganiser:

What steps will reproduce the problem?
If possible, include a link to a program on
1. Have the AutobahnPython WAMP server running
(, examples/wamp/rpc/simple/example1/
1. import ""
2. client, err := websocket.Dial("ws://localhost:9000/", "wamp",
3. if err != nil { file bug report }

What is the expected output?
It should work. In the initial request headers, there should be a line
"Sec-WebSocket-Protocol: wamp".

What do you see instead?
1. The protocol is not set on the Config object.
2. No such header is sent.
3. The AutobahnPython server responds with "HTTP/1.1 400 this server only speaks
4. Dial abort with ErrBadStatus.

Which compiler are you using (5g, 6g, 8g, gccgo)?
Irrelevant. (But "go". Why does it ask this like this? Aren't 5g, 6g and 8g
obsoleted by "go"?)

Which operating system are you using?
Irrelevant. (But Ubuntu 12.04 64-bit.)

Which version are you using?  (run 'go version')
Irrelevant. It's in that the problem is. (But it's

Please provide any additional information below.

In the package "", the function Dial (in
client.go) has three arguments: (url_, protocol, string). However, that protocol
argument isn't used.

I believe it's meant to map to the websocket subprotocol as represented in
Config.Protocol, i.e. config.Protocol = []string{protocol}.

In the mean time, I can't use Dial; I have to instead do just what it does, with setting
config.Protocol in the midst of it:

    config, err := websocket.NewConfig(url, origin)
    if err != nil {
        return nil, err
    config.Protocol = []string{"wamp"}
    ws, err := websocket.DialConfig(config)

Incidentally, given the compiler's admirable objection to unused variables, I'm mildly
surprised it doesn't complain of unused function parameters (though to be sure there
would need to be a way of suppressing such errors, but _ could be used).
Copy link

@ukai ukai commented Sep 27, 2012

Comment 1:

Thanks for the report. 
I'll fix websocket.Dial to use protocol parameter.
Copy link

@rsc rsc commented Oct 6, 2012

Comment 2:

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

Status changed to Accepted.

Copy link

@ukai ukai commented Oct 9, 2012

Comment 3:

This issue was closed by revision golang/net@5a65403.

Status changed to Fixed.

@gopherbot gopherbot added fixed labels Oct 9, 2012
@mikioh mikioh added repo-net and removed repo-net labels Dec 23, 2014
@mikioh mikioh changed the title Dial doesn't use parameter "protocol" websocket: Dial doesn't use parameter "protocol" Jan 4, 2015
@mikioh mikioh changed the title websocket: Dial doesn't use parameter "protocol" x/net/websocket: Dial doesn't use parameter "protocol" Jul 30, 2015
@mikioh mikioh modified the milestone: Unreleased Jul 30, 2015
@golang golang locked and limited conversation to collaborators Aug 5, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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