Skip to content
This repository was archived by the owner on Mar 22, 2025. It is now read-only.

Commit ebbb495

Browse files
committed
Forgot to add a link to useful info, and a line of code to properly close connection
1 parent 75522b0 commit ebbb495

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ZigBeeValve/thing.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ func sendRequest(req *http.Request) (err error) {
361361

362362
// --- HOW TO CONNECT AND LISTEN TO A WEBSOCKET ---
363363
// Port 443, can be found by curl -v "http://localhost:8080/api/[apikey]/config", and getting the "websocketport". Will make a function to automatically get this port
364+
// https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/websocket/
364365
// https://stackoverflow.com/questions/32745716/i-need-to-connect-to-an-existing-websocket-server-using-go-lang
365366
// https://pkg.go.dev/github.com/coder/websocket#Conn
366367
// https://pkg.go.dev/github.com/coder/websocket#Conn.Read
@@ -391,5 +392,6 @@ func initWebsocketClient(ctx context.Context) (err error) {
391392
return
392393
}
393394
log.Println("Read from websocket:", bodyString)
395+
ws.Close(websocket.StatusNormalClosure, "No longer need to listen to websocket")
394396
return
395397
}

0 commit comments

Comments
 (0)