github.com/stafiprotocol/go-substrate-rpc-client@v1.4.7/pkg/recws/keepalive.go (about) 1 package recws 2 3 import ( 4 "sync" 5 "time" 6 ) 7 8 type keepAliveResponse struct { 9 lastResponse time.Time 10 sync.RWMutex 11 } 12 13 func (k *keepAliveResponse) setLastResponse() { 14 k.Lock() 15 defer k.Unlock() 16 17 k.lastResponse = time.Now() 18 } 19 20 func (k *keepAliveResponse) getLastResponse() time.Time { 21 k.RLock() 22 defer k.RUnlock() 23 24 return k.lastResponse 25 }