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 <misad90@gmail.com>
  • Loading branch information
fulder committed Jun 18, 2020
1 parent ad86f96 commit 39c2d72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion websocket.go
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 39c2d72

Please sign in to comment.