mirror of
https://github.com/uNetworking/uWebSockets.js.git
synced 2025-12-19 18:10:26 -05:00
Update UpgradeAsync.js (#926)
This commit is contained in:
22
examples/UpgradeAsync.js
vendored
22
examples/UpgradeAsync.js
vendored
@@ -35,15 +35,19 @@ const app = uWS./*SSL*/App({
|
||||
return;
|
||||
}
|
||||
|
||||
/* This immediately calls open handler, you must not use res after this call */
|
||||
res.upgrade({
|
||||
url: url
|
||||
},
|
||||
/* Use our copies here */
|
||||
secWebSocketKey,
|
||||
secWebSocketProtocol,
|
||||
secWebSocketExtensions,
|
||||
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,
|
||||
context
|
||||
);
|
||||
});
|
||||
|
||||
}, 1000);
|
||||
|
||||
/* You MUST register an abort handler to know if the upgrade was aborted by peer */
|
||||
|
||||
Reference in New Issue
Block a user