Skip to content

Commit 6b7c8a9

Browse files
author
ionut.stan
committed
Fixed example.
1 parent f0f748d commit 6b7c8a9

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ jsonrpcServer.addPlugin(new JSONRPC.Plugins.Server.AuthenticationSkip());
264264
jsonrpcServer.addPlugin(new JSONRPC.Plugins.Server.AuthorizeAll());
265265

266266

267-
const webSocket = new WebSocket("ws://localhost/api");
267+
const webSocket = new WebSocket("ws://localhost:8080/api");
268268
await new Promise((fnResolve, fnReject) => {
269269
webSocket.on("open", fnResolve);
270270
webSocket.on("error", fnReject);

bug.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const WebSocket = require("uws");
2+
const WebSocketServer = WebSocket.Server;
3+
4+
5+
(async () => {
6+
const webSocketServer = new WebSocketServer({port: 8080});
7+
webSocketServer.on("error", console.error);
8+
webSocketServer.on("connection", console.log);
9+
webSocketServer.on("message", console.log);
10+
11+
12+
13+
const webSocket = new WebSocket("ws://localhost:8080/api");
14+
await new Promise((fnResolve, fnReject) => {
15+
webSocket.on("open", fnResolve);
16+
webSocket.on("error", fnReject);
17+
});
18+
19+
let str10MBPayload = "";
20+
let nIterator = 0;
21+
while(str10MBPayload.length < 10 * 1024 * 1024 /*10 MB*/)
22+
{
23+
str10MBPayload += str10MBPayload + "_" + (++nIterator);
24+
}
25+
26+
webSocket.on("close", process.exit);
27+
webSocket.send(str10MBPayload);
28+
})();

0 commit comments

Comments
 (0)