From dc79848115af807b6eb1147c4486f104c8c38d39 Mon Sep 17 00:00:00 2001 From: Atsushi Watanabe Date: Tue, 24 Dec 2019 19:23:36 +0900 Subject: [PATCH] Fix WebSocket dial URL and payload type setting (#37) --- conn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conn.go b/conn.go index 6815f2d..27e50e9 100644 --- a/conn.go +++ b/conn.go @@ -113,8 +113,7 @@ func (d *DialOptions) dial(urlStr string) (*BaseClient, error) { } c.Transport = conn case "ws", "wss": - wsc, err := websocket.NewConfig( - fmt.Sprintf("%s://%s:%s%s", u.Scheme, u.Hostname(), u.Port(), u.EscapedPath()), "ws://") + wsc, err := websocket.NewConfig(u.String(), fmt.Sprintf("https://%s", u.Host)) if err != nil { return nil, err } @@ -125,6 +124,7 @@ func (d *DialOptions) dial(urlStr string) (*BaseClient, error) { if err != nil { return nil, err } + ws.PayloadType = websocket.BinaryFrame c.Transport = ws default: return nil, ErrUnsupportedProtocol