How to use the @microsoft/signalr.TransferFormat.Text 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 / ConnectionTests.ts View on Github external
const connection = new HttpConnection(ECHOENDPOINT_URL, {
            ...commonOptions,
        });

        connection.onreceive = async (data: any) => {
            if (data === message) {
                connection.stop();
            }
        };

        connection.onclose = (error: any) => {
            expect(error).toBeUndefined();
            done();
        };

        connection.start(TransferFormat.Text).then(() => {
            connection.send(message);
        }).catch((e) => {
            fail(e);
            done();
        });
    });
github dotnet / aspnetcore / src / SignalR / clients / ts / FunctionalTests / ts / ConnectionTests.ts View on Github external
transport: transportType,
                    });

                    connection.onreceive = (data: any) => {
                        if ((typeof data === "string" && data === message) ||
                            (data instanceof ArrayBuffer && new TextDecoder("utf-8").decode(data) === message)) {
                            connection.stop();
                        }
                    };

                    connection.onclose = (error: any) => {
                        expect(error).toBeUndefined();
                        done();
                    };

                    connection.start(TransferFormat.Text).then(() => {
                        connection.send(message);
                    }).catch((e: any) => {
                        fail(e);
                        done();
                    });
                });