UNPKG

@microsoft/teams.apps

Version:

<p> <a href="https://www.npmjs.com/package/@microsoft/teams.apps" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.apps/latest" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.apps?activeTab=code

44 lines (43 loc) • 2.09 kB
import { ILogger } from '@microsoft/teams.common'; import { ISocketConnection, SocketConnectionContext, SocketConnectionHandlers } from './types'; /** * A `@microsoft/signalr`-backed {@link ISocketConnection}. Negotiates through * Teams backend service, opens the Azure SignalR socket, and does not resolve {@link start} until * the Teams backend service `SocketReady` readiness frame arrives (or the readiness timeout * elapses). * * Returning a value from the `Activity` handler is what drives SignalR client * results: Teams backend service awaits the returned reply frame as the invocation result. */ export declare class SignalRSocketConnection implements ISocketConnection { private readonly context; private readonly handlers; private readonly log?; /** Access-token lifetime from the negotiate response; drives proactive refresh. */ expiresInSeconds?: number; /** Local token-expiry deadline; see {@link ISocketConnection.expiresAtMs}. */ expiresAtMs?: number; /** This socket's server identity; see {@link ISocketConnection.connectionId}. */ connectionId?: string; private connection?; private stopped; /** * Whether the readiness gate has been settled (resolved or rejected). Guards * the `SocketReady` handler so a duplicate or late readiness frame — including * one that arrives after {@link stop} — cannot re-fire `onReady` or otherwise * act on an already-settled connection. */ private settled; constructor(context: SocketConnectionContext, handlers: SocketConnectionHandlers, log?: ILogger | undefined); /** Whether SignalR is connected and stopping has not begun. */ get isOpen(): boolean; start(signal?: AbortSignal): Promise<void>; stop(): Promise<void>; private throwIfAborted; /** * Bridge the SignalR client's internal diagnostics into the app's * {@link ILogger} so they surface through the SDK's logging pipeline (and * respect its configured level) instead of SignalR's default console logger. */ private signalRLogger; }