There was an error while loading. Please reload this page.
1 parent 9358393 commit c187e4fCopy full SHA for c187e4f
1 file changed
examples/UpgradeAsync.js
@@ -35,15 +35,19 @@ const app = uWS./*SSL*/App({
35
return;
36
}
37
38
- /* This immediately calls open handler, you must not use res after this call */
39
- res.upgrade({
40
- url: url
41
- },
42
- /* Use our copies here */
43
- secWebSocketKey,
44
- secWebSocketProtocol,
45
- secWebSocketExtensions,
46
- context);
+ /* Cork any async response including upgrade */
+ res.cork(() => {
+ /* This immediately calls open handler, you must not use res after this call */
+ res.upgrade(
+ { url: url },
+ /* Use our copies here */
+ secWebSocketKey,
+ secWebSocketProtocol,
+ secWebSocketExtensions,
47
+ context
48
+ );
49
+ });
50
+
51
}, 1000);
52
53
/* You MUST register an abort handler to know if the upgrade was aborted by peer */
0 commit comments