ping
This commit is contained in:
parent
07ddb59e63
commit
08818103a9
|
|
@ -128,6 +128,16 @@ export function ActionScreen () {
|
||||||
console.log(`Action State: ${actionState}`);
|
console.log(`Action State: ${actionState}`);
|
||||||
}, [actionState]);
|
}, [actionState]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let interval= 0;
|
||||||
|
if (readyState == ReadyState.OPEN) {
|
||||||
|
interval = setInterval(() => {
|
||||||
|
sendMessage(ser(createPacket("ping", {})))
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
return () => clearInterval(interval)
|
||||||
|
}, [readyState, sendMessage]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleMessage(lastMessage)
|
handleMessage(lastMessage)
|
||||||
setUpdateScreen(v => ++v)
|
setUpdateScreen(v => ++v)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user