From ba0eb2a1233da1b7b6415dc2d2f2cf18521b709a Mon Sep 17 00:00:00 2001 From: lakinduakash Date: Thu, 23 May 2019 16:25:16 +0530 Subject: [PATCH] Support TLS --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index a2930d5..251babc 100644 --- a/main.go +++ b/main.go @@ -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()