Skip to content

Commit 260cd32

Browse files
test: add failing tests showing the issue in socketio#698
1 parent 0efa04b commit 260cd32

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

test/server.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,13 +2759,23 @@ describe("server", () => {
27592759
});
27602760
});
27612761

2762-
it("should execute in multipart packet", (done) => {
2762+
it("should execute in multipart packet (websocket)", (done) => {
27632763
const engine = listen((port) => {
2764-
const socket = new ClientSocket(`ws://localhost:${port}`);
2764+
const socket = new ClientSocket(`ws://localhost:${port}`, {
2765+
transports: ["websocket"],
2766+
});
27652767
let i = 0;
27662768
let j = 0;
27672769

27682770
engine.on("connection", (conn) => {
2771+
conn.send("d", (transport) => {
2772+
i++;
2773+
});
2774+
2775+
conn.send("c", (transport) => {
2776+
i++;
2777+
});
2778+
27692779
conn.send("b", (transport) => {
27702780
i++;
27712781
});

test/webtransport.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,21 @@ describe("WebTransport", () => {
373373
});
374374
});
375375

376+
it("should invoke send callbacks (server to client)", (done) => {
377+
setup({}, async ({ engine, h3Server, socket, reader }) => {
378+
const messageCount = 4;
379+
let receivedCallbacks = 0;
380+
381+
for (let i = 0; i < messageCount; i++) {
382+
socket.send("hello", () => {
383+
if (++receivedCallbacks === messageCount) {
384+
success(engine, h3Server, done);
385+
}
386+
});
387+
}
388+
});
389+
});
390+
376391
it("should send some binary data (client to server)", (done) => {
377392
setup({}, async ({ engine, h3Server, socket, writer }) => {
378393
socket.on("data", (data) => {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy