Can't connect to websocket server..
I use the exact same private.key
and public.crt
that I use with nginx
The cert is self-signed but works fine with the rest of the website over HTTPS via nginx
The websocket server works when using ws://
when the line with http.ListenAndServe()
is uncommented
package main
import (
"flag"
"fmt"
"log"
"net/http"
)
const PORT uint = 8000
func main(){
host := parse_flags()
hub := newHub()
go hub.run()
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
serve(hub, w, r)
})
server_host := fmt.Sprintf("%s:%d", host, PORT)
log.Println("Server listening on:", server_host)
err := http.ListenAndServeTLS(server_host, fmt.Sprintf("/var/ini/ssl/%s/public.crt", host), fmt.Sprintf("/var/ini/ssl/%s/private.key", host), nil)
//err := http.ListenAndServe(server_host, nil)
if err != nil {
log.Fatal("ListenAndServe:", err)
}
}