mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-05-12 05:44:04 -05:00
12 lines
497 B
TypeScript
12 lines
497 B
TypeScript
import { create } from '@bufbuild/protobuf';
|
|
import { WebClient } from '../../WebClient';
|
|
import { Command_Ping_ext, Command_PingSchema } from '@app/generated';
|
|
|
|
export function ping(pingReceived: () => void): void {
|
|
// Uses `onResponse` (not `onSuccess`) so KeepAliveService treats any server
|
|
// reply as proof of life, independent of responseCode.
|
|
WebClient.instance.protobuf.sendSessionCommand(Command_Ping_ext, create(Command_PingSchema), {
|
|
onResponse: () => pingReceived(),
|
|
});
|
|
}
|