How to use the @microsoft/signalr.HttpTransportType.ServerSentEvents function in @microsoft/signalr

To help you get started, we’ve selected a few @microsoft/signalr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dotnet / aspnetcore / src / SignalR / clients / ts / FunctionalTests / ts / Common.ts View on Github external
export function getHttpTransportTypes(): HttpTransportType[] {
    const transportTypes = [];
    if (typeof window === "undefined") {
        transportTypes.push(HttpTransportType.WebSockets);
        transportTypes.push(HttpTransportType.ServerSentEvents);
    } else {
        if (typeof WebSocket !== "undefined") {
            transportTypes.push(HttpTransportType.WebSockets);
        }
        if (typeof EventSource !== "undefined") {
            transportTypes.push(HttpTransportType.ServerSentEvents);
        }
    }
    transportTypes.push(HttpTransportType.HttpStreaming);
    transportTypes.push(HttpTransportType.LongPolling);

    return transportTypes;
}
github dotnet / aspnetcore / src / SignalR / clients / ts / FunctionalTests / ts / Common.ts View on Github external
export function getHttpTransportTypes(): HttpTransportType[] {
    const transportTypes = [];
    if (typeof window === "undefined") {
        transportTypes.push(HttpTransportType.WebSockets);
        transportTypes.push(HttpTransportType.ServerSentEvents);
    } else {
        if (typeof WebSocket !== "undefined") {
            transportTypes.push(HttpTransportType.WebSockets);
        }
        if (typeof EventSource !== "undefined") {
            transportTypes.push(HttpTransportType.ServerSentEvents);
        }
    }
    transportTypes.push(HttpTransportType.HttpStreaming);
    transportTypes.push(HttpTransportType.LongPolling);

    return transportTypes;
}