Skip to content

Commit

Permalink
Support TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
lakinduakash committed May 23, 2019
1 parent 98019c9 commit ba0eb2a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ func StartSever(port string, path string) {
}
}

//start with TLS support. Provide privatekey and cert path. Then you need to usee "wss" protocole in client
func StartSeverTLS(port string, path string, privatekey string, cert string) {
fmt.Println("Distributed Chat App")
setupRoutes(path)
if err := http.ListenAndServeTLS(port, cert, privatekey, nil); err != nil {
fmt.Println("Cannot serve on port ", port)
return
}
}

//Get connected client list to sever
func GetClients() map[string]*websocket.Client {
return pool.GetClients()
Expand Down

0 comments on commit ba0eb2a

Please sign in to comment.