Skip to content

Commit

Permalink
Use wss:// schema if URL has https:// prefix else use ws:// to avoid …
Browse files Browse the repository at this point in the history
…"websocket: bad handshake" error
  • Loading branch information
Nikita Kryuchkov committed Oct 2, 2017
1 parent 3929d71 commit 4a28084
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,11 @@ func (c *clientConn) onOpen() error {
return InvalidError
}

c.request.URL.Scheme = "ws"
if c.request.URL.Scheme == "https" {
c.request.URL.Scheme = "wss"
} else {
c.request.URL.Scheme = "ws"
}
q.Set("sid", c.id)
q.Set("transport", "websocket")
c.request.URL.RawQuery = q.Encode()
Expand Down

0 comments on commit 4a28084

Please sign in to comment.