uwebsockets 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Makefile +11 -0
- package/README.md +38 -44
- package/build.c +185 -0
- package/docs/Makefile +2 -0
- package/docs/generated/.nojekyll +1 -0
- package/docs/generated/assets/highlight.css +22 -0
- package/docs/generated/assets/main.js +4 -0
- package/docs/generated/assets/search.js +1 -0
- package/docs/generated/assets/style.css +1280 -0
- package/docs/generated/enums/ListenOptions.html +70 -0
- package/docs/generated/functions/App.html +94 -0
- package/docs/generated/functions/SSLApp.html +93 -0
- package/docs/generated/functions/getParts.html +95 -0
- package/docs/generated/functions/us_listen_socket_close.html +93 -0
- package/docs/generated/functions/us_socket_local_port.html +93 -0
- package/docs/generated/index.html +131 -0
- package/docs/generated/interfaces/AppOptions.html +115 -0
- package/docs/generated/interfaces/HttpRequest.html +204 -0
- package/docs/generated/interfaces/HttpResponse.html +400 -0
- package/docs/generated/interfaces/MultipartField.html +88 -0
- package/docs/generated/interfaces/TemplatedApp.html +595 -0
- package/docs/generated/interfaces/WebSocket.html +303 -0
- package/docs/generated/interfaces/WebSocketBehavior.html +331 -0
- package/docs/generated/interfaces/us_listen_socket.html +89 -0
- package/docs/generated/interfaces/us_socket.html +89 -0
- package/docs/generated/interfaces/us_socket_context_t.html +89 -0
- package/docs/generated/types/CompressOptions.html +84 -0
- package/docs/generated/types/RecognizedString.html +89 -0
- package/docs/generated/variables/DEDICATED_COMPRESSOR_128KB.html +84 -0
- package/docs/generated/variables/DEDICATED_COMPRESSOR_16KB.html +84 -0
- package/docs/generated/variables/DEDICATED_COMPRESSOR_256KB.html +84 -0
- package/docs/generated/variables/DEDICATED_COMPRESSOR_32KB.html +84 -0
- package/docs/generated/variables/DEDICATED_COMPRESSOR_3KB.html +84 -0
- package/docs/generated/variables/DEDICATED_COMPRESSOR_4KB.html +84 -0
- package/docs/generated/variables/DEDICATED_COMPRESSOR_64KB.html +84 -0
- package/docs/generated/variables/DEDICATED_COMPRESSOR_8KB.html +84 -0
- package/docs/generated/variables/DEDICATED_DECOMPRESSOR.html +84 -0
- package/docs/generated/variables/DEDICATED_DECOMPRESSOR_16KB.html +84 -0
- package/docs/generated/variables/DEDICATED_DECOMPRESSOR_1KB.html +84 -0
- package/docs/generated/variables/DEDICATED_DECOMPRESSOR_2KB.html +84 -0
- package/docs/generated/variables/DEDICATED_DECOMPRESSOR_32KB.html +84 -0
- package/docs/generated/variables/DEDICATED_DECOMPRESSOR_4KB.html +84 -0
- package/docs/generated/variables/DEDICATED_DECOMPRESSOR_512B.html +84 -0
- package/docs/generated/variables/DEDICATED_DECOMPRESSOR_8KB.html +84 -0
- package/docs/generated/variables/DISABLED.html +84 -0
- package/docs/generated/variables/SHARED_COMPRESSOR.html +84 -0
- package/docs/generated/variables/SHARED_DECOMPRESSOR.html +84 -0
- package/docs/index.d.ts +395 -0
- package/docs/report.pdf +0 -0
- package/docs/tsconfig.json +11 -0
- package/examples/AsyncFunction.js +43 -0
- package/examples/AutomaticPortSelection.js +20 -0
- package/examples/Backpressure.js +75 -0
- package/examples/Broadcast.js +39 -0
- package/examples/GracefulShutdown.js +39 -0
- package/examples/H3lloWorld.js +23 -0
- package/examples/Headers.js +31 -0
- package/examples/HelloWorld.js +18 -0
- package/examples/JsonPost.js +72 -0
- package/examples/ProxyProtocol.js +25 -0
- package/examples/PubSub.js +57 -0
- package/examples/RateLimit.js +69 -0
- package/examples/Router.js +30 -0
- package/examples/ServerName.js +34 -0
- package/examples/ServerSentEvents.js +48 -0
- package/examples/SlowReceiver.js +53 -0
- package/examples/Upgrade.js +51 -0
- package/examples/UpgradeAsync.js +80 -0
- package/examples/Upload.js +36 -0
- package/examples/VideoStreamer.js +115 -0
- package/examples/VideoStreamerSync.js +42 -0
- package/examples/WebSockets.js +37 -0
- package/examples/WorkerThreads.js +33 -0
- package/misc/Manycast latency comparison [lower is better].png +0 -0
- package/misc/addon.pro +24 -0
- package/misc/cert.pem +21 -0
- package/misc/chart.png +0 -0
- package/misc/features_strip.png +0 -0
- package/misc/host.pro +31 -0
- package/misc/key.pem +28 -0
- package/misc/logo.svg +1 -0
- package/misc/streaming.png +0 -0
- package/package.json +1 -1
- package/src/AppWrapper.h +734 -0
- package/src/HttpRequestWrapper.h +196 -0
- package/src/HttpResponseWrapper.h +463 -0
- package/src/Utilities.h +172 -0
- package/src/WebSocketWrapper.h +348 -0
- package/src/addon.cpp +437 -0
- package/src/host.cpp +115 -0
- package/src/uws.js +24 -0
- package/tests/Autobahn.js +102 -0
- package/tests/Hammer.js +203 -0
- package/tests/Makefile +2 -0
- package/tests/fuzzingclient.json +28 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* This is an example of async streaming of large files.
|
|
2
|
+
* Try navigating to the adderss with Chrome and see the video
|
|
3
|
+
* in real time. */
|
|
4
|
+
|
|
5
|
+
const uWS = require('../dist/uws.js');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
const port = 9001;
|
|
9
|
+
const fileName = 'C:\\Users\\Alex\\Downloads\\Sintel.2010.720p.mkv';
|
|
10
|
+
const totalSize = fs.statSync(fileName).size;
|
|
11
|
+
|
|
12
|
+
let openStreams = 0;
|
|
13
|
+
let streamIndex = 0;
|
|
14
|
+
|
|
15
|
+
console.log('Video size is: ' + totalSize + ' bytes');
|
|
16
|
+
|
|
17
|
+
/* Helper function converting Node.js buffer to ArrayBuffer */
|
|
18
|
+
function toArrayBuffer(buffer) {
|
|
19
|
+
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Either onAborted or simply finished request */
|
|
23
|
+
function onAbortedOrFinishedResponse(res, readStream) {
|
|
24
|
+
|
|
25
|
+
if (res.id == -1) {
|
|
26
|
+
console.log("ERROR! onAbortedOrFinishedResponse called twice for the same res!");
|
|
27
|
+
} else {
|
|
28
|
+
console.log('Stream was closed, openStreams: ' + --openStreams);
|
|
29
|
+
console.timeEnd(res.id);
|
|
30
|
+
readStream.destroy();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Mark this response already accounted for */
|
|
34
|
+
res.id = -1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Helper function to pipe the ReadaleStream over an Http responses */
|
|
38
|
+
function pipeStreamOverResponse(res, readStream, totalSize) {
|
|
39
|
+
/* Careful! If Node.js would emit error before the first res.tryEnd, res will hang and never time out */
|
|
40
|
+
/* For this demo, I skipped checking for Node.js errors, you are free to PR fixes to this example */
|
|
41
|
+
readStream.on('data', (chunk) => {
|
|
42
|
+
/* We only take standard V8 units of data */
|
|
43
|
+
const ab = toArrayBuffer(chunk);
|
|
44
|
+
|
|
45
|
+
/* Store where we are, globally, in our response */
|
|
46
|
+
let lastOffset = res.getWriteOffset();
|
|
47
|
+
|
|
48
|
+
/* Streaming a chunk returns whether that chunk was sent, and if that chunk was last */
|
|
49
|
+
let [ok, done] = res.tryEnd(ab, totalSize);
|
|
50
|
+
|
|
51
|
+
/* Did we successfully send last chunk? */
|
|
52
|
+
if (done) {
|
|
53
|
+
onAbortedOrFinishedResponse(res, readStream);
|
|
54
|
+
} else if (!ok) {
|
|
55
|
+
/* If we could not send this chunk, pause */
|
|
56
|
+
readStream.pause();
|
|
57
|
+
|
|
58
|
+
/* Save unsent chunk for when we can send it */
|
|
59
|
+
res.ab = ab;
|
|
60
|
+
res.abOffset = lastOffset;
|
|
61
|
+
|
|
62
|
+
/* Register async handlers for drainage */
|
|
63
|
+
res.onWritable((offset) => {
|
|
64
|
+
/* Here the timeout is off, we can spend as much time before calling tryEnd we want to */
|
|
65
|
+
|
|
66
|
+
/* On failure the timeout will start */
|
|
67
|
+
let [ok, done] = res.tryEnd(res.ab.slice(offset - res.abOffset), totalSize);
|
|
68
|
+
if (done) {
|
|
69
|
+
onAbortedOrFinishedResponse(res, readStream);
|
|
70
|
+
} else if (ok) {
|
|
71
|
+
/* We sent a chunk and it was not the last one, so let's resume reading.
|
|
72
|
+
* Timeout is still disabled, so we can spend any amount of time waiting
|
|
73
|
+
* for more chunks to send. */
|
|
74
|
+
readStream.resume();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* We always have to return true/false in onWritable.
|
|
78
|
+
* If you did not send anything, return true for success. */
|
|
79
|
+
return ok;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}).on('error', () => {
|
|
84
|
+
/* Todo: handle errors of the stream, probably good to simply close the response */
|
|
85
|
+
console.log('Unhandled read error from Node.js, you need to handle this!');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/* If you plan to asyncronously respond later on, you MUST listen to onAborted BEFORE returning */
|
|
89
|
+
res.onAborted(() => {
|
|
90
|
+
onAbortedOrFinishedResponse(res, readStream);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Yes, you can easily swap to SSL streaming by uncommenting here */
|
|
95
|
+
const app = uWS./*SSL*/App({
|
|
96
|
+
key_file_name: 'misc/key.pem',
|
|
97
|
+
cert_file_name: 'misc/cert.pem',
|
|
98
|
+
passphrase: '1234'
|
|
99
|
+
}).get('/sintel.mkv', (res, req) => {
|
|
100
|
+
/* Log */
|
|
101
|
+
console.time(res.id = ++streamIndex);
|
|
102
|
+
console.log('Stream was opened, openStreams: ' + ++openStreams);
|
|
103
|
+
/* Create read stream with Node.js and start streaming over Http */
|
|
104
|
+
const readStream = fs.createReadStream(fileName);
|
|
105
|
+
pipeStreamOverResponse(res, readStream, totalSize);
|
|
106
|
+
}).get('/*', (res, req) => {
|
|
107
|
+
/* Make sure to always handle every route */
|
|
108
|
+
res.end('Nothing to see here!');
|
|
109
|
+
}).listen(port, (token) => {
|
|
110
|
+
if (token) {
|
|
111
|
+
console.log('Listening to port ' + port);
|
|
112
|
+
} else {
|
|
113
|
+
console.log('Failed to listen to port ' + port);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* This is an example of sync copying of large files.
|
|
2
|
+
* NEVER DO THIS; ONLY FOR TESTING PURPOSES. WILL CAUSE
|
|
3
|
+
* SEVERE BACKPRESSURE AND HORRIBLE PERFORMANCE.
|
|
4
|
+
* Try navigating to the adderss with Chrome and see the video
|
|
5
|
+
* in real time. */
|
|
6
|
+
|
|
7
|
+
const uWS = require('../dist/uws.js');
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
|
|
10
|
+
const port = 9001;
|
|
11
|
+
const fileName = '/home/alexhultman/Downloads/Sintel.2010.720p.mkv';
|
|
12
|
+
const videoFile = toArrayBuffer(fs.readFileSync(fileName));
|
|
13
|
+
const totalSize = videoFile.byteLength;
|
|
14
|
+
|
|
15
|
+
console.log('WARNING: NEVER DO LIKE THIS; WILL CAUSE HORRIBLE BACKPRESSURE!');
|
|
16
|
+
console.log('Video size is: ' + totalSize + ' bytes');
|
|
17
|
+
|
|
18
|
+
/* Helper function converting Node.js buffer to ArrayBuffer */
|
|
19
|
+
function toArrayBuffer(buffer) {
|
|
20
|
+
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Yes, you can easily swap to SSL streaming by uncommenting here */
|
|
24
|
+
const app = uWS.SSLApp({
|
|
25
|
+
key_file_name: 'misc/key.pem',
|
|
26
|
+
cert_file_name: 'misc/cert.pem',
|
|
27
|
+
passphrase: '1234'
|
|
28
|
+
}).get('/sintel.mkv', (res, req) => {
|
|
29
|
+
/* Log */
|
|
30
|
+
console.log("Copying Sintel video...");
|
|
31
|
+
/* Copy the entire video to backpressure */
|
|
32
|
+
res.end(videoFile);
|
|
33
|
+
}).get('/*', (res, req) => {
|
|
34
|
+
/* Make sure to always handle every route */
|
|
35
|
+
res.end('Nothing to see here!');
|
|
36
|
+
}).listen(port, (token) => {
|
|
37
|
+
if (token) {
|
|
38
|
+
console.log('Listening to port ' + port);
|
|
39
|
+
} else {
|
|
40
|
+
console.log('Failed to listen to port ' + port);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* A quite detailed WebSockets example */
|
|
2
|
+
|
|
3
|
+
const uWS = require('../dist/uws.js');
|
|
4
|
+
const port = 9001;
|
|
5
|
+
|
|
6
|
+
const app = uWS./*SSL*/App({
|
|
7
|
+
key_file_name: 'misc/key.pem',
|
|
8
|
+
cert_file_name: 'misc/cert.pem',
|
|
9
|
+
passphrase: '1234'
|
|
10
|
+
}).ws('/*', {
|
|
11
|
+
/* Options */
|
|
12
|
+
compression: uWS.SHARED_COMPRESSOR,
|
|
13
|
+
maxPayloadLength: 16 * 1024 * 1024,
|
|
14
|
+
idleTimeout: 10,
|
|
15
|
+
/* Handlers */
|
|
16
|
+
open: (ws) => {
|
|
17
|
+
console.log('A WebSocket connected!');
|
|
18
|
+
},
|
|
19
|
+
message: (ws, message, isBinary) => {
|
|
20
|
+
/* Ok is false if backpressure was built up, wait for drain */
|
|
21
|
+
let ok = ws.send(message, isBinary);
|
|
22
|
+
},
|
|
23
|
+
drain: (ws) => {
|
|
24
|
+
console.log('WebSocket backpressure: ' + ws.getBufferedAmount());
|
|
25
|
+
},
|
|
26
|
+
close: (ws, code, message) => {
|
|
27
|
+
console.log('WebSocket closed');
|
|
28
|
+
}
|
|
29
|
+
}).any('/*', (res, req) => {
|
|
30
|
+
res.end('Nothing to see here!');
|
|
31
|
+
}).listen(port, (token) => {
|
|
32
|
+
if (token) {
|
|
33
|
+
console.log('Listening to port ' + port);
|
|
34
|
+
} else {
|
|
35
|
+
console.log('Failed to listen to port ' + port);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* This example spawns two worker threads, each with their own
|
|
2
|
+
* server listening to the same port (Linux feature). */
|
|
3
|
+
|
|
4
|
+
const uWS = require('../dist/uws.js');
|
|
5
|
+
const port = 9001;
|
|
6
|
+
const { Worker, isMainThread, threadId } = require('worker_threads');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
if (isMainThread) {
|
|
10
|
+
/* Main thread loops over all CPUs */
|
|
11
|
+
/* In this case we only spawn two (hardcoded) */
|
|
12
|
+
/*os.cpus()*/[0, 1].forEach(() => {
|
|
13
|
+
/* Spawn a new thread running this source file */
|
|
14
|
+
new Worker(__filename);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/* I guess main thread joins by default? */
|
|
18
|
+
} else {
|
|
19
|
+
/* Here we are inside a worker thread */
|
|
20
|
+
const app = uWS.SSLApp({
|
|
21
|
+
key_file_name: 'misc/key.pem',
|
|
22
|
+
cert_file_name: 'misc/cert.pem',
|
|
23
|
+
passphrase: '1234'
|
|
24
|
+
}).get('/*', (res, req) => {
|
|
25
|
+
res.end('Hello Worker!');
|
|
26
|
+
}).listen(port, (token) => {
|
|
27
|
+
if (token) {
|
|
28
|
+
console.log('Listening to port ' + port + ' from thread ' + threadId);
|
|
29
|
+
} else {
|
|
30
|
+
console.log('Failed to listen to port ' + port + ' from thread ' + threadId);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
Binary file
|
package/misc/addon.pro
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
TEMPLATE = app
|
|
2
|
+
CONFIG += console c++1z
|
|
3
|
+
CONFIG -= app_bundle
|
|
4
|
+
CONFIG -= qt
|
|
5
|
+
|
|
6
|
+
SOURCES += \
|
|
7
|
+
../src/addon.cpp \
|
|
8
|
+
../uWebSockets/uSockets/src/eventing/epoll.c \
|
|
9
|
+
../uWebSockets/uSockets/src/context.c \
|
|
10
|
+
../uWebSockets/uSockets/src/socket.c \
|
|
11
|
+
../uWebSockets/uSockets/src/eventing/libuv.c \
|
|
12
|
+
../uWebSockets/uSockets/src/ssl.c \
|
|
13
|
+
../uWebSockets/uSockets/src/loop.c
|
|
14
|
+
|
|
15
|
+
INCLUDEPATH += ../targets/node-v11.1.0/include/node
|
|
16
|
+
INCLUDEPATH += ../uWebSockets/src
|
|
17
|
+
INCLUDEPATH += ../uWebSockets/uSockets/src
|
|
18
|
+
|
|
19
|
+
HEADERS += \
|
|
20
|
+
../src/AppWrapper.h \
|
|
21
|
+
../src/HttpRequestWrapper.h \
|
|
22
|
+
../src/HttpResponseWrapper.h \
|
|
23
|
+
../src/Utilities.h \
|
|
24
|
+
../src/WebSocketWrapper.h
|
package/misc/cert.pem
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIDXTCCAkWgAwIBAgIJAKLdQVPy90jjMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
|
|
3
|
+
BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
|
|
4
|
+
aWRnaXRzIFB0eSBMdGQwHhcNMTkwMjAzMTQ0OTM1WhcNMjAwMjAzMTQ0OTM1WjBF
|
|
5
|
+
MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50
|
|
6
|
+
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
|
|
7
|
+
CgKCAQEA7i7IIEdICTiSTVx+ma6xHxOtcbd6wGW3nkxlCkJ1UuV8NmY5ovMsGnGD
|
|
8
|
+
hJJtUQ2j5ig5BcJUf3tezqCNW4tKnSOgSISfEAKvpn2BPvaFq3yx2Yjz0ruvcGKp
|
|
9
|
+
DMZBXmB/AAtGyN/UFXzkrcfppmLHJTaBYGG6KnmU43gPkSDy4iw46CJFUOupc51A
|
|
10
|
+
FIz7RsE7mbT1plCM8e75gfqaZSn2k+Wmy+8n1HGyYHhVISRVvPqkS7gVLSVEdTea
|
|
11
|
+
UtKP1Vx/818/HDWk3oIvDVWI9CFH73elNxBkMH5zArSNIBTehdnehyAevjY4RaC/
|
|
12
|
+
kK8rslO3e4EtJ9SnA4swOjCiqAIQEwIDAQABo1AwTjAdBgNVHQ4EFgQUv5rc9Smm
|
|
13
|
+
9c4YnNf3hR49t4rH4yswHwYDVR0jBBgwFoAUv5rc9Smm9c4YnNf3hR49t4rH4ysw
|
|
14
|
+
DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEATcL9CAAXg0u//eYUAlQa
|
|
15
|
+
L+l8yKHS1rsq1sdmx7pvsmfZ2g8ONQGfSF3TkzkI2OOnCBokeqAYuyT8awfdNUtE
|
|
16
|
+
EHOihv4ZzhK2YZVuy0fHX2d4cCFeQpdxno7aN6B37qtsLIRZxkD8PU60Dfu9ea5F
|
|
17
|
+
DDynnD0TUabna6a0iGn77yD8GPhjaJMOz3gMYjQFqsKL252isDVHEDbpVxIzxPmN
|
|
18
|
+
w1+WK8zRNdunAcHikeoKCuAPvlZ83gDQHp07dYdbuZvHwGj0nfxBLc9qt90XsBtC
|
|
19
|
+
4IYR7c/bcLMmKXYf0qoQ4OzngsnPI5M+v9QEHvYWaKVwFY4CTcSNJEwfXw+BAeO5
|
|
20
|
+
OA==
|
|
21
|
+
-----END CERTIFICATE-----
|
package/misc/chart.png
ADDED
|
Binary file
|
|
Binary file
|
package/misc/host.pro
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
TEMPLATE = app
|
|
2
|
+
CONFIG += console c++1z
|
|
3
|
+
CONFIG -= app_bundle
|
|
4
|
+
CONFIG -= qt
|
|
5
|
+
|
|
6
|
+
SOURCES += \
|
|
7
|
+
src/host.cpp \
|
|
8
|
+
src/addon.cpp \
|
|
9
|
+
uWebSockets/uSockets/src/eventing/epoll.c \
|
|
10
|
+
uWebSockets/uSockets/src/context.c \
|
|
11
|
+
uWebSockets/uSockets/src/socket.c \
|
|
12
|
+
uWebSockets/uSockets/src/eventing/libuv.c \
|
|
13
|
+
uWebSockets/uSockets/src/ssl.c \
|
|
14
|
+
uWebSockets/uSockets/src/loop.c
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#Separate the Node.js addon from host compilation
|
|
18
|
+
QMAKE_CXXFLAGS += -DADDON_IS_HOST
|
|
19
|
+
|
|
20
|
+
INCLUDEPATH += /home/alexhultman/v8/v8/include
|
|
21
|
+
INCLUDEPATH += uWebSockets/src
|
|
22
|
+
INCLUDEPATH += uWebSockets/uSockets/src
|
|
23
|
+
|
|
24
|
+
# We can link statically when I figure out how to compile V8 properly
|
|
25
|
+
LIBS += /home/alexhultman/v8/v8/out/x64.release/libv8_libplatform.so
|
|
26
|
+
LIBS += /home/alexhultman/v8/v8/out/x64.release/libv8_libbase.so
|
|
27
|
+
LIBS += /home/alexhultman/v8/v8/out/x64.release/libv8.so
|
|
28
|
+
LIBS += /home/alexhultman/v8/v8/out/x64.release/libicui18n.so
|
|
29
|
+
LIBS += /home/alexhultman/v8/v8/out/x64.release/libicuuc.so
|
|
30
|
+
|
|
31
|
+
LIBS += -lssl -lcrypto
|
package/misc/key.pem
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
-----BEGIN PRIVATE KEY-----
|
|
2
|
+
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDuLsggR0gJOJJN
|
|
3
|
+
XH6ZrrEfE61xt3rAZbeeTGUKQnVS5Xw2Zjmi8ywacYOEkm1RDaPmKDkFwlR/e17O
|
|
4
|
+
oI1bi0qdI6BIhJ8QAq+mfYE+9oWrfLHZiPPSu69wYqkMxkFeYH8AC0bI39QVfOSt
|
|
5
|
+
x+mmYsclNoFgYboqeZTjeA+RIPLiLDjoIkVQ66lznUAUjPtGwTuZtPWmUIzx7vmB
|
|
6
|
+
+pplKfaT5abL7yfUcbJgeFUhJFW8+qRLuBUtJUR1N5pS0o/VXH/zXz8cNaTegi8N
|
|
7
|
+
VYj0IUfvd6U3EGQwfnMCtI0gFN6F2d6HIB6+NjhFoL+QryuyU7d7gS0n1KcDizA6
|
|
8
|
+
MKKoAhATAgMBAAECggEAd5g/3o1MK20fcP7PhsVDpHIR9faGCVNJto9vcI5cMMqP
|
|
9
|
+
6xS7PgnSDFkRC6EmiLtLn8Z0k2K3YOeGfEP7lorDZVG9KoyE/doLbpK4MfBAwBG1
|
|
10
|
+
j6AHpbmd5tVzQrnNmuDjBBelbDmPWVbD0EqAFI6mphXPMqD/hFJWIz1mu52Kt2s6
|
|
11
|
+
++MkdqLO0ORDNhKmzu6SADQEcJ9Suhcmv8nccMmwCsIQAUrfg3qOyqU4//8QB8ZM
|
|
12
|
+
josO3gMUesihVeuF5XpptFjrAliPgw9uIG0aQkhVbf/17qy0XRi8dkqXj3efxEDp
|
|
13
|
+
1LSqZjBFiqJlFchbz19clwavMF/FhxHpKIhhmkkRSQKBgQD9blaWSg/2AGNhRfpX
|
|
14
|
+
Yq+6yKUkUD4jL7pmX1BVca6dXqILWtHl2afWeUorgv2QaK1/MJDH9Gz9Gu58hJb3
|
|
15
|
+
ymdeAISwPyHp8euyLIfiXSAi+ibKXkxkl1KQSweBM2oucnLsNne6Iv6QmXPpXtro
|
|
16
|
+
nTMoGQDS7HVRy1on5NQLMPbUBQKBgQDwmN+um8F3CW6ZV1ZljJm7BFAgNyJ7m/5Q
|
|
17
|
+
YUcOO5rFbNsHexStrx/h8jYnpdpIVlxACjh1xIyJ3lOCSAWfBWCS6KpgeO1Y484k
|
|
18
|
+
EYhGjoUsKNQia8UWVt+uWnwjVSDhQjy5/pSH9xyFrUfDg8JnSlhsy0oC0C/PBjxn
|
|
19
|
+
hxmADSLnNwKBgQD2A51USVMTKC9Q50BsgeU6+bmt9aNMPvHAnPf76d5q78l4IlKt
|
|
20
|
+
wMs33QgOExuYirUZSgjRwknmrbUi9QckRbxwOSqVeMOwOWLm1GmYaXRf39u2CTI5
|
|
21
|
+
V9gTMHJ5jnKd4gYDnaA99eiOcBhgS+9PbgKSAyuUlWwR2ciL/4uDzaVeDQKBgDym
|
|
22
|
+
vRSeTRn99bSQMMZuuD5N6wkD/RxeCbEnpKrw2aZVN63eGCtkj0v9LCu4gptjseOu
|
|
23
|
+
7+a4Qplqw3B/SXN5/otqPbEOKv8Shl/PT6RBv06PiFKZClkEU2T3iH27sws2EGru
|
|
24
|
+
w3C3GaiVMxcVewdg1YOvh5vH8ZVlxApxIzuFlDvnAoGAN5w+gukxd5QnP/7hcLDZ
|
|
25
|
+
F+vesAykJX71AuqFXB4Wh/qFY92CSm7ImexWA/L9z461+NKeJwb64Nc53z59oA10
|
|
26
|
+
/3o2OcIe44kddZXQVP6KTZBd7ySVhbtOiK3/pCy+BQRsrC7d71W914DxNWadwZ+a
|
|
27
|
+
jtwwKjDzmPwdIXDSQarCx0U=
|
|
28
|
+
-----END PRIVATE KEY-----
|
package/misc/logo.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg version="1.1" viewBox="0.0 0.0 187.65616797900262 113.39370078740157" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l187.65617 0l0 113.3937l-187.65617 0l0 -113.3937z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l187.65617 0l0 113.3937l-187.65617 0z" fill-rule="evenodd"/><g filter="url(#shadowFilter-p.1)"><use xlink:href="#p.1" transform="matrix(1.0 0.0 0.0 1.0 0.0 2.0)"/></g><defs><filter id="shadowFilter-p.1" filterUnits="userSpaceOnUse"><feGaussianBlur in="SourceAlpha" stdDeviation="2.0" result="blur"/><feComponentTransfer in="blur" color-interpolation-filters="sRGB"><feFuncR type="linear" slope="0" intercept="0.0"/><feFuncG type="linear" slope="0" intercept="0.0"/><feFuncB type="linear" slope="0" intercept="0.0"/><feFuncA type="linear" slope="0.5" intercept="0"/></feComponentTransfer></filter></defs><g id="p.1"><defs><linearGradient id="p.2" gradientUnits="userSpaceOnUse" gradientTransform="matrix(10.20750017422515 0.0 0.0 10.20750017422515 0.0 0.0)" spreadMethod="pad" x1="0.6655852909187749" y1="0.31561582701378876" x2="0.6655483156810289" y2="10.523116001171969"><stop offset="0.0" stop-color="#3177ee"/><stop offset="1.0" stop-color="#113d8a"/></linearGradient></defs><path fill="url(#p.2)" d="m103.745865 15.829906c1.2349167 0 1.8523712 1.2349148 1.8523712 3.7047462c0 4.1163883 -2.2017822 10.58773 -6.605362 19.414024c-0.29676056 -3.4079819 -0.44514465 -6.2320175 -0.44514465 -8.4720955c0 -9.76445 1.7327118 -14.646675 5.1981354 -14.646675zm47.55861 -12.607628c-1.3497925 0 -2.733078 0.34941483 -4.149887 1.0482426c-5.7629395 2.7091556 -11.377502 7.533942 -16.843674 14.474361c-4.4705887 5.8778133 -8.94117 12.966614 -13.411758 21.266397c-4.882225 9.4676895 -8.409874 16.231007 -10.582939 20.289951c-3.771759 7.055298 -6.772888 11.377502 -9.003395 12.966614c2.5847015 -4.1163864 3.87706 -9.20443 3.87706 -15.264133c0 -1.177475 -0.24890137 -3.4558449 -0.7466965 -6.8351135c-0.4977951 -3.3792686 -0.89507294 -6.480915 -1.1918335 -9.304947c5.7054977 -9.821888 8.55825 -17.087786 8.55825 -21.797697c0 -3.23567 -1.2923508 -4.853506 -3.87706 -4.853506c-0.6509628 0 -1.3880844 0.26804543 -2.2113647 0.80413055c-2.9389038 1.7039948 -5.025818 5.3465176 -6.2607346 10.927568c-0.8807144 4.0015106 -1.3210678 7.8881474 -1.3210678 11.659903c0 3.7621841 0.11487579 6.701092 0.34462738 8.816723c-3.1112213 5.466175 -6.6388702 10.908421 -10.582947 16.326736c-6.117134 8.519962 -11.119026 13.603222 -15.005661 15.249767c-0.64138794 0.29676056 -0.9620819 0.5935211 -0.9620819 0.8902893c0 0.29676056 0.08615875 0.44514465 0.25846863 0.44514465c2.125206 0 6.744171 -4.5328064 13.856903 -13.598427c5.351303 -6.7010956 9.558632 -12.492756 12.621986 -17.37498c0.11487579 1.646553 0.6126709 4.824787 1.4933853 9.5346985c0.6509628 4.0589447 0.97644806 7.304188 0.97644806 9.735729c0 2.4411163 -0.32548523 4.164253 -0.97644806 5.1694183c-0.46907043 0.11487579 -0.7036133 0.36377716 -0.7036133 0.74668884c0 0.3829193 0.05744171 0.57437897 0.1723175 0.57437897c2.4123917 0 6.7633133 -5.6480637 13.0527725 -16.944191c1.177475 -2.0581932 3.3074646 -5.9208946 6.389969 -11.588104c3.0920715 -5.6767807 5.523613 -10.046848 7.2946167 -13.110207c5.7629395 -9.707012 11.468445 -16.88197 17.1165 -21.524868c4.4035797 -3.4079847 8.285431 -5.1119766 11.645554 -5.1119766c4.0589447 0 6.0884094 1.9672489 6.0884094 5.9017477l-0.52537537 2.880206l0 0c-2.3648834 0.9902582 -4.4858246 2.3851423 -6.3628387 4.184661l-0.1723175 0c-2.115631 0 -3.9392853 0.83763504 -5.4709625 2.512909c-1.5316772 1.6752758 -2.2975159 3.5994453 -2.2975159 5.7725143c0 4.413147 1.8810883 8.003017 5.64328 10.769611c1.1200409 0.8232765 2.8383942 2.0151138 5.15506 3.575512c2.326233 1.5603981 4.049362 2.7809525 5.169403 3.6616707c3.7047577 2.757019 5.557129 6.313385 5.557129 10.669098c0 3.1207962 -1.2636414 6.0932083 -3.7909088 8.917236c-2.5272675 2.8240356 -5.38002 4.882225 -8.558258 6.1745834c-1.2923431 0.41163635 -2.8527374 0.7323303 -4.681183 0.9620819c-0.41163635 0 -0.61746216 0.17710114 -0.61746216 0.5313034c0 0.18188477 0.14837646 0.27282715 0.44514465 0.27282715c4.298279 0 8.5056 -1.780571 12.621994 -5.341728c4.116379 -3.5611496 6.174576 -7.4286423 6.174576 -11.602463c0 -4.1738205 -1.8810883 -7.821129 -5.64328 -10.941925c-5.829956 -3.9440765 -9.362381 -6.385189 -10.597305 -7.3233376c-3.8196106 -2.8814735 -5.729431 -6.3516846 -5.729431 -10.410627c0 -1.7614326 0.5887451 -3.4654255 1.7662201 -5.1119766c1.234909 -1.5316811 2.7330933 -2.3836746 4.494522 -2.5559883l0 0c-1.9433136 2.1156292 -2.914978 4.4657993 -2.914978 7.0505066c0 3.8866348 2.0007477 7.179743 6.0022583 9.879324c1.0626068 0.7084007 2.857544 1.8571587 5.3848114 3.4462776c2.5272675 1.5891151 4.437088 2.8527489 5.729431 3.790905c4.0589447 2.824028 6.0884247 6.5287743 6.0884247 11.114239c0 7.4765053 -4.4083557 12.976185 -13.225082 16.49905c-5.1215515 2.115631 -9.946335 3.1734467 -14.474365 3.1734467c-4.528015 0 -8.4673 -1.3402252 -11.817856 -4.0206604c-3.3505402 -2.6708603 -5.025818 -6.428253 -5.025818 -11.27219c0 -4.853508 1.8523712 -8.7257805 5.5571136 -11.616825c3.4654236 -2.8144608 7.5818176 -4.2216873 12.349167 -4.2216873l1.4933777 0c0.94773865 0 1.4216003 -0.062229156 1.4216003 -0.18667603c0 -0.46907425 -1.3833008 -0.7036133 -4.1499023 -0.7036133c-4.997101 0 -9.395889 1.6321907 -13.196365 4.8965836c-3.7909012 3.2643929 -5.6863556 7.4717216 -5.6863556 12.621986c0 5.1406937 2.3549576 9.065628 7.064865 11.77478c3.7621918 2.230507 8.831085 3.3457565 15.206696 3.3457565c6.385193 0 12.373093 -1.646553 17.963715 -4.939659c6.7010956 -3.9345016 10.051651 -9.1661415 10.051651 -15.69492c0 -4.824787 -1.9720459 -8.855011 -5.916107 -12.090683c-4.700348 -2.9389114 -8.376373 -5.293865 -11.028091 -7.064869c-3.9919434 -2.6995811 -5.9879 -5.844309 -5.9879 -9.434181c0 -1.589117 0.41163635 -3.1160088 1.234909 -4.580675c2.699585 -4.7673492 7.725403 -7.151024 15.077454 -7.151024c2.6517181 0 5.0354004 0.38292122 7.1510315 1.1487598c3.0537872 1.0530262 4.580673 2.6421452 4.580673 4.7673473c0 1.4646683 -0.8232727 2.5655632 -2.4698334 3.3026829c-1.6465454 0.73711777 -3.4654083 1.1056805 -5.456604 1.1056805c-5.88739 0 -10.448914 -1.0578175 -13.684586 -3.1734467c-0.057434082 -0.06701279 -0.16275024 -0.10051727 -0.3159027 -0.10051727c-0.14360046 0 -0.21539307 0.062223434 -0.21539307 0.18667412c0 0.11487579 0.06222534 0.22975159 0.18666077 0.34462738c1.8188782 1.2923546 4.0828857 2.2065754 6.792038 2.7426624c2.5847168 0.64138985 5.05455 0.9620838 7.4095 0.9620838c2.35495 0 4.413147 -0.34941292 6.174576 -1.0482407c2.4698334 -0.8902893 3.7047424 -2.3023033 3.7047424 -4.2360497c0 -1.0051632 -0.354187 -1.948103 -1.0625916 -2.8288174c-2.2879486 -2.8814716 -6.729828 -4.3222055 -13.325607 -4.3222055c-3.337906 0 -6.3659973 0.5138922 -9.08429 1.5416708l0 0c0.044937134 -0.20180702 0.08959961 -0.41893482 0.13400269 -0.65138245c0.32546997 -1.7135639 0.4882202 -2.8910418 0.4882202 -3.5324335c0 -2.2400799 -0.5887451 -4.125959 -1.7662201 -5.6576366c-1.0626068 -1.5221055 -2.7091522 -2.2831583 -4.9396667 -2.2831583zm-88.39699 5.02582c-0.8232727 0 -1.2349129 0.29197693 -1.2349129 0.8759289c0 0.18188572 0.14359283 0.3302679 0.43078232 0.4451437c3.178234 0.5935259 5.590626 3.1543016 7.237179 7.6823244c-1.1200409 -0.18188858 -2.2352905 -0.27283096 -3.3457565 -0.27283096c-4.7673492 0 -9.386318 1.4263744 -13.856903 4.279127c-4.470585 2.8527527 -7.677536 6.3995457 -9.620857 10.640379c-1.4072266 3.1686592 -2.1108437 6.0501328 -2.1108437 8.644409c0 2.5847092 0.24889755 4.6141853 0.74669266 6.088421c0.49779892 1.4646683 1.541256 2.699585 3.130371 3.7047462c1.3593636 0.9381561 3.1255798 1.4072304 5.298649 1.4072304c2.1730652 0 4.8487167 -1.0721703 8.026951 -3.2165222c3.1782303 -2.153923 5.4709625 -4.403576 6.8781967 -6.7489586c0.12445068 -0.23932648 0.1866684 -0.44514465 0.1866684 -0.61745834c0 -0.18188858 -0.062217712 -0.27283096 -0.1866684 -0.27283096c-0.11487579 0 -0.25847626 0.11966324 -0.43078613 0.3589859c-1.7710037 2.4123955 -3.8627014 4.4418716 -6.275097 6.0884247c-2.4123917 1.6465492 -4.781708 2.4698296 -7.1079445 2.4698296c-2.3166618 0 -4.197754 -0.7036133 -5.643276 -2.1108437c-1.4359512 -1.4168015 -2.153923 -3.7143173 -2.153923 -6.8925514c0 -5.590626 2.0438309 -10.750467 6.1315002 -15.4795265c4.0876656 -4.7386303 8.898094 -7.1079445 14.431282 -7.1079445c2.5272713 0 4.762562 0.61745834 6.7058754 1.8523731c0.9381561 3.829197 1.4072342 8.553467 1.4072342 14.1728115c0 5.6097717 -1.0290985 12.353947 -3.087288 20.232513c-1.1200409 4.413151 -2.8719025 10.324467 -5.2555733 17.733967c-2.3836746 7.4094925 -3.575512 11.425362 -3.575512 12.047607c0 0.6222458 0.057437897 0.93336487 0.17231369 0.93336487c0.12445068 0 0.27283096 -0.1483841 0.44514465 -0.44514465c3.829197 -6.4139023 6.8446846 -14.383415 9.046474 -23.908543c2.211357 -9.5346985 3.3170395 -18.504585 3.3170395 -26.909676c0 -4.7673473 -0.35420227 -9.032114 -1.0625992 -12.7943l0 0c3.87706 3.4079838 5.81559 9.170923 5.81559 17.288822c0 4.4705887 -0.8519974 9.91283 -2.5559921 16.326733c-1.1200333 3.87706 -2.6804352 8.711418 -4.6811905 14.503082c-1.9911804 5.8012314 -2.9867706 8.859802 -2.9867706 9.175705c0 0.32548523 0.23453522 0.48822784 0.7036133 0.48822784c0.1723175 0 0.34941864 -0.08615875 0.5313034 -0.25847626c5.2268524 -10.118645 8.429016 -16.647423 9.606491 -19.586334c3.0633621 -7.4094925 4.5950394 -14.407352 4.5950394 -20.993565c0 -11.411007 -3.9727936 -18.236547 -11.918373 -20.476627c-1.7614288 -6.2320166 -4.346138 -9.348024 -7.7541237 -9.348024zm-36.48411 29.724134c-1.091322 0 -1.814085 0.7658386 -2.1682816 2.2975159c-0.995594 3.829193 -3.082508 8.39072 -6.2607365 13.684589c-0.35419846 0.64138794 -0.62224007 1.139183 -0.80413055 1.4933853c-0.17231369 0.35419846 -0.36377716 0.6796799 -0.57437897 0.97644806c-0.20103264 0.28718948 -0.3589878 0.5504494 -0.4738636 0.7897682c0 0.2297554 0.16274261 0.3446312 0.48822212 0.3446312c0.3254795 0 1.9002342 -2.4411125 4.72427 -7.3233376c1.7614288 -2.9963455 2.8479614 -5.1119766 3.2596035 -6.3468933l0 0c0 3.5898705 -0.61745834 7.1941032 -1.8523731 10.812691c-1.2349148 3.6185913 -3.001133 7.8689995 -5.2986507 12.7512245l-5.4709625 11.817856c-3.4654255 7.466934 -5.198134 13.08149 -5.198134 16.843674l0 0.27283478c0 2.9389114 1.1056805 5.509262 3.317041 7.7110443c2.2017899 2.2113647 4.7146997 3.317047 7.5387297 3.317047c1.1104698 0 2.5033398 -0.39728546 4.17861 -1.1918411c1.6848488 -0.79455566 2.8192482 -1.7231369 3.4031982 -2.785736l0 0c-3.178236 1.943306 -5.8826065 2.9149704 -8.11311 2.9149704c-3.4175568 0 -5.126335 -2.5320663 -5.126335 -7.596176c0 -5.054535 1.297142 -11.229111 3.8914204 -18.523735c0.17231369 -0.46907043 0.49301147 -1.5125275 0.9620857 -3.1303635c0.46907425 -1.617836 1.732708 -4.8965836 3.790903 -9.83625c6.6532307 -4.882225 11.15732 -9.616066 13.512276 -14.20153l0 0c-0.29676056 3.2356758 -0.44514465 5.734226 -0.44514465 7.4956512c0 4.355713 1.2349167 6.5335693 3.7047462 6.5335693c2.4698334 0 4.7338448 -1.4120178 6.792038 -4.2360497l0 -0.17231369c0 -0.35419846 -0.08615875 -0.5313034 -0.25847244 -0.5313034c0.057437897 0 -0.047863007 0.11966705 -0.31590652 0.35898972c-0.26804733 0.22975159 -0.8567848 0.7275429 -1.7662163 1.4933891c-0.9094353 0.7658386 -1.8045082 1.1487579 -2.6852264 1.1487579c-1.7710037 0 -2.6565018 -1.4120216 -2.6565018 -4.2360497c0 -4.1738205 0.6509628 -8.467308 1.9528885 -12.880459c1.110466 -1.4742393 1.665699 -3.0920715 1.665699 -4.853504c0 -0.65096664 -0.46907806 -0.97644806 -1.4072266 -0.97644806c-0.9381523 0 -1.6130447 0.20582199 -2.0246887 0.61745834c-1.0051651 1.3019257 -1.7997246 4.011078 -2.3836746 8.127468c-3.2931118 5.466175 -7.4094944 10.08036 -12.349157 13.842541c1.8188667 -5.4661713 3.0825005 -9.199638 3.790905 -11.200394c1.5316753 -4.5280266 2.2975178 -8.261494 2.2975178 -11.2003975c0 -2.9484825 -0.5456619 -4.422722 -1.636982 -4.422722z" fill-rule="evenodd"/></g></g></svg>
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uwebsockets",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "µWebSockets.js is a web server bypass for Node.js that reimplements eventing, networking, encryption, web protocols, routing and pub/sub in highly optimized C++. As such, µWebSockets.js delivers web serving for Node.js, 8.5x that of Fastify and at least 10x that of Socket.IO. It is also the built-in web server of Bun.",
|
|
5
5
|
"main": "uws.js",
|
|
6
6
|
"types": "./index.d.ts",
|