forked from link1st/gowebsocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
添加页面模板
- Loading branch information
Showing
9 changed files
with
120 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Created by GoLand. | ||
* User: link1st | ||
* Date: 2019-07-25 | ||
* Time: 12:11 | ||
*/ | ||
|
||
package home | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"net/http" | ||
) | ||
|
||
// 查看用户是否在线 | ||
func Index(c *gin.Context) { | ||
data := gin.H{ | ||
"title": "聊天首页", | ||
} | ||
c.HTML(http.StatusOK, "index.tpl", data) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Created by GoLand. | ||
* User: link1st | ||
* Date: 2019-07-31 | ||
* Time: 15:17 | ||
*/ | ||
|
||
package task | ||
|
||
import ( | ||
"fmt" | ||
"gowebsocket/servers/websocket" | ||
"runtime/debug" | ||
"time" | ||
) | ||
|
||
func Init() { | ||
Timer(3*time.Second, 30*time.Second, cleanConnection, "") | ||
|
||
} | ||
|
||
// 清理超时连接 | ||
func cleanConnection(param interface{}) (result bool) { | ||
result = true | ||
|
||
defer func() { | ||
if r := recover(); r != nil { | ||
fmt.Println("ClearTimeoutConnections stop", r, string(debug.Stack())) | ||
} | ||
}() | ||
|
||
fmt.Println("定时任务,清理超时连接", param) | ||
|
||
websocket.ClearTimeoutConnections() | ||
|
||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>{{ .title }}</title> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |