1
0
mirror of https://github.com/taigrr/log-socket synced 2025-01-18 04:53:14 -08:00

1 Commits

Author SHA1 Message Date
b65a10e7a8 detect tls presence based on incoming request for websocket 2021-07-05 16:10:50 -07:00

View File

@@ -7,7 +7,12 @@ import (
)
func LogSocketViewHandler(w http.ResponseWriter, r *http.Request) {
wsResource := "ws://" + r.Host + r.URL.Path
wsResource := r.Host + r.URL.Path
if r.TLS != nil {
wsResource = "wss://" + wsResource
} else {
wsResource = "ws://" + wsResource
}
wsResource = strings.TrimSuffix(wsResource, "/") + "/ws"
homeTemplate.Execute(w, wsResource)
}