|
@@ -17,6 +17,10 @@ func main() {
|
17
|
17
|
if os.Getenv("PORT") != "" {
|
18
|
18
|
port = os.Getenv("PORT")
|
19
|
19
|
}
|
|
20
|
+ serverName := "localhost"
|
|
21
|
+ if os.Getenv("SERVER_NAME") != "" {
|
|
22
|
+ serverName = os.Getenv("SERVER_NAME")
|
|
23
|
+ }
|
20
|
24
|
|
21
|
25
|
rand.Seed(time.Now().Unix())
|
22
|
26
|
|
|
@@ -26,8 +30,8 @@ func main() {
|
26
|
30
|
|
27
|
31
|
router.GET("/", func(c *gin.Context) {
|
28
|
32
|
c.HTML(http.StatusOK, "index.html", gin.H{
|
29
|
|
- "websocket": "ws://localhost:" + port + "/ws",
|
30
|
|
- "sse": "http://localhost:" + port + "/sse",
|
|
33
|
+ "websocket": "ws://" + serverName + ":" + port + "/ws",
|
|
34
|
+ "sse": "http://" + serverName + ":" + port + "/sse",
|
31
|
35
|
})
|
32
|
36
|
})
|
33
|
37
|
router.GET("/ws", websocketHandler(websocket.Upgrader{
|