Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
im-pool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoyanbin
im-pool
Commits
6bfe9ee4
Commit
6bfe9ee4
authored
May 29, 2023
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log
parent
2b657f5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
client.go
pool/client.go
+1
-1
publicApi.go
pool/publicApi.go
+2
-2
No files found.
pool/client.go
View file @
6bfe9ee4
...
...
@@ -195,7 +195,7 @@ Loop:
if
msg
.
ProcedureType
==
9
{
pingMsg
:=
&
SendMsg
{
ProcedureType
:
10
}
c
.
send
(
pingMsg
)
fmt
.
Println
(
"收到ping:"
,
c
.
User
)
//
fmt.Println("收到ping:", c.User)
}
SaveMsg
(
msg
)
...
...
pool/publicApi.go
View file @
6bfe9ee4
...
...
@@ -93,7 +93,7 @@ func (c *Client) OpenClient(w http.ResponseWriter, r *http.Request, head http.He
c
.
closeTicker
=
time
.
NewTimer
(
closeWait
)
c
.
conn
.
SetPongHandler
(
func
(
str
string
)
error
{
c
.
conn
.
SetReadDeadline
(
time
.
Now
()
.
Add
(
pongWait
))
fmt
.
Println
(
"收到pong---"
,
c
.
User
,
str
)
//
fmt.Println("收到pong---", c.User, str)
c
.
pingPeriodTicker
.
Reset
(
pingPeriod
)
c
.
onPong
()
return
nil
...
...
@@ -102,7 +102,7 @@ func (c *Client) OpenClient(w http.ResponseWriter, r *http.Request, head http.He
c
.
conn
.
SetPingHandler
(
func
(
str
string
)
error
{
c
.
conn
.
SetReadDeadline
(
time
.
Now
()
.
Add
(
pongWait
))
c
.
pingPeriodTicker
.
Reset
(
pingPeriod
)
fmt
.
Println
(
"收到ping---"
,
c
.
User
,
str
)
//
fmt.Println("收到ping---", c.User, str)
c
.
recvPing
<-
1
//if err := c.conn.WriteMessage(websocket.PongMessage, nil); err != nil {
// c.onError(errors.New("回复客户端PongMessage出现异常:"+err.Error()))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment