Closed champ-isaac closed 2 years ago
Sorry about that guys!
I forget to config websocket TLSOptions.....Orz
All you need to do is setup websocket TLSOptions, for example
ws := server.WsServer{
Server: &http.Server{Addr: ":8883"},
Path: listener.Websocket.Path,
}
// setup TLSOptions
if listener.TLSOptions != nil {
ws.CertFile = listener.TLSOptions.Cert //cert file path
ws.KeyFile = listener.TLSOptions.Key //cert key file path
}
srv := server.New(
server.WithTCPListener(ln),
server.WithWebsocketServer(&ws),
server.WithLogger(l),
server.WithConfig(c))
in my config.yaml file,
After gmqtt server beginning, I try to connect to this url
wss://serverip:8883
, but it's failed to connect to this url. However, if I connect tows://serverrip:8883
, it's work.How can I connect to gmqtt server with TLS?