UNPKG

@pureweb/platform-streaming-agent

Version:

The PureWeb platform streaming agent enables your game to communicate and stream through the PureWeb Platform

26 lines (25 loc) 1.25 kB
import { ServerWritableStream } from '@grpc/grpc-js'; import { IEnvironmentServer } from './proto/sidecar_grpc_pb'; import { HeartBeatResponse, HeartBeatRequest } from './proto/sidecar_pb'; import { ILocalAgent } from '@pureweb/platform-sdk'; import { ConnectionStates } from '../../ConnectionStates'; import { IConnectionService } from '../../IConnectionService'; export declare class EnvironmentServer implements IEnvironmentServer, IConnectionService { private static readonly DEFAULT_HEART_RATE; private static readonly DEFAULT_TIMEOUT; private readonly heartRate; private readonly timeout; private readonly agent; private pulse; private currentState; private connectionStateChangedCallback; constructor(agent: ILocalAgent, heartRate?: number, timeout?: number); onStateChanged(handler: (state: ConnectionStates) => void): void; get currentStatus(): ConnectionStates; /** gRPC Clients call this to open the heartbeat stream. * Once the stream is open the server will regularly send heartbeat messages to verify that the stream is still open. */ heartBeat(call: ServerWritableStream<HeartBeatRequest, HeartBeatResponse>): void; private sendHeartbeat; private stopHeartbeat; }