summaryrefslogtreecommitdiff
path: root/plugins/websockets/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/websockets/plugin.go')
-rw-r--r--plugins/websockets/plugin.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/websockets/plugin.go b/plugins/websockets/plugin.go
index bc5028e6..76ef800d 100644
--- a/plugins/websockets/plugin.go
+++ b/plugins/websockets/plugin.go
@@ -134,8 +134,11 @@ func (p *Plugin) Middleware(next http.Handler) http.Handler {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
+
+ // construct safe connection protected by mutexes
safeConn := connection.NewConnection(_conn, p.log)
defer func() {
+ // close the connection on exit
err = safeConn.Close()
if err != nil {
p.log.Error("connection close error", "error", err)