1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-04 11:44:00 +00:00

send const ping payload

This commit is contained in:
Kane York 2017-11-08 14:40:51 -08:00
parent 9c9fde0160
commit 26cddf5271

View file

@ -480,6 +480,8 @@ func runSocketReader(conn *websocket.Conn, client *ClientInfo, errorChan chan<-
// exit goroutine // exit goroutine
} }
var pingPayload = []byte("PING")
func runSocketWriter(conn *websocket.Conn, client *ClientInfo, errorChan <-chan error, clientChan <-chan ClientMessage, serverMessageChan <-chan ClientMessage) websocket.CloseError { func runSocketWriter(conn *websocket.Conn, client *ClientInfo, errorChan <-chan error, clientChan <-chan ClientMessage, serverMessageChan <-chan ClientMessage) websocket.CloseError {
lastPacket := time.Now() lastPacket := time.Now()
@ -509,7 +511,7 @@ func runSocketWriter(conn *websocket.Conn, client *ClientInfo, errorChan <-chan
} }
conn.WriteControl( conn.WriteControl(
websocket.PingMessage, websocket.PingMessage,
[]byte(strconv.FormatInt(time.Now().Unix(), 10)), pingPayload,
getDeadline(), getDeadline(),
) )
continue continue
@ -522,7 +524,7 @@ func runSocketWriter(conn *websocket.Conn, client *ClientInfo, errorChan <-chan
if msg.Command == "__ping" { if msg.Command == "__ping" {
// generated for PONG packets // generated for PONG packets
// want this to run AFTER lastPacket was set // want to branch AFTER lastPacket is set
continue continue
} }