pingInterval property
The interval at which ping frames are sent to keep the web-socket connection alive.
If null, no ping messages are sent.
Implementation
@override
Duration? get pingInterval => _pingInterval;
The interval at which ping frames are sent to keep the web-socket connection alive.
If null, no ping messages are sent.
Implementation
@override
set pingInterval(Duration? value) {
_pingInterval = value;
_pingTimer?.cancel();
_pingTimer = null;
_pongPending = false;
if (value == null || _closeSent) return;
_pingTimer = Timer.periodic(value, (_) {
if (!pingAnswered()) {
goAway(1001, '');
onPeerUnresponsive();
return;
}
_pongPending = true;
onPing();
sendFrame(WebSocketOpcode.ping, Uint8List(0));
});
}