Skip to content

Commit

Permalink
update to correct method name and comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Jul 10, 2024
1 parent a91a8b9 commit 58cd8ee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/msggateway/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (c *Client) readMessage() {
c.conn.SetReadLimit(maxMessageSize)
_ = c.conn.SetReadDeadline(pongWait)
c.conn.SetPingHandler(c.pingHandler)
go c.heartbeat(c.hbCtx)
go c.activeHeartbeat(c.hbCtx)

for {
log.ZDebug(c.ctx, "readMessage")
Expand Down Expand Up @@ -240,7 +240,7 @@ func (c *Client) close() {

c.closed.Store(true)
c.conn.Close()
<-c.hbCtx.Done() // Close initiated heartbeat in server send.
<-c.hbCtx.Done() // Close server-initiated heartbeat.
c.longConnServer.UnRegister(c)
}

Expand Down Expand Up @@ -327,7 +327,8 @@ func (c *Client) writeBinaryMsg(resp Resp) error {
return c.conn.WriteMessage(MessageBinary, encodedBuf)
}

func (c *Client) heartbeat(ctx context.Context) {
// Actively initiate Heartbeat when platform in Web.
func (c *Client) activeHeartbeat(ctx context.Context) {
if c.PlatformID == constant.WebPlatformID {
log.ZDebug(ctx, "server initiative send heartbeat start.")
ticker := time.NewTicker(pingPeriod)
Expand Down

0 comments on commit 58cd8ee

Please sign in to comment.