Skip to content

Commit

Permalink
chore: Prolong connection lifetime with server-side callback
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed May 12, 2024
1 parent 2035913 commit f03d641
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tool/echo/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ func Centrifuge() (*centrifuge.Node, error) {

client.OnRefresh(func(e centrifuge.RefreshEvent, cb centrifuge.RefreshCallback) {
log.Printf("[user %s] connection is going to expire, refreshing", client.UserID())
// Prolong connection lifetime with that server side callback.
// Without notification to client.
cb(centrifuge.RefreshReply{
ExpireAt: time.Now().Unix() + 25,
}, nil)
Expand Down

0 comments on commit f03d641

Please sign in to comment.