title: websocket - Error in connection establishment: net::ERR_INSECURE_RESPONSE
body: <p>Can't connect to websocket server..</p>
  
  <p>I use the exact same <code>private.key</code> and <code>public.crt</code> that I use with <code>nginx</code> </p>
  
  <p>The cert is self-signed but works fine with the rest of the website over HTTPS via nginx</p>
  
  <p>The websocket server works when using <code>ws://</code> when the line with <code>http.ListenAndServe()</code> is uncommented</p>
  
  <pre><code>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)
      }
  }
  </code></pre>