Skip to content

Commit

Permalink
Log response info duriung websocket handshake failure
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Sadowski <[email protected]>
  • Loading branch information
fulder committed Jun 18, 2020
1 parent 4f70f2e commit 23b35d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mqtt

import (
"crypto/tls"
"fmt"
"io"
"net"
"net/http"
Expand Down Expand Up @@ -44,8 +45,11 @@ func NewWebsocket(host string, tlsc *tls.Config, timeout time.Duration, requestH
WriteBufferSize: options.WriteBufferSize,
}

ws, _, err := dialer.Dial(host, requestHeader)
ws, resp, err := dialer.Dial(host, requestHeader)

if resp != nil {
WARN.Println(CLI, fmt.Sprintf("Websocket handshake failure. StatusCode: %d. Body: %s", resp.StatusCode, resp.Body))
}
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 23b35d7

Please sign in to comment.