Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
});
});
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();
});
});