We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
url.parse()
new URL()
1 parent 5e42cfd commit 8be840eCopy full SHA for 8be840e
README.md
@@ -245,7 +245,6 @@ server.listen(8080);
245
246
```js
247
import { createServer } from 'http';
248
-import { parse } from 'url';
249
import { WebSocketServer } from 'ws';
250
251
const server = createServer();
@@ -265,7 +264,7 @@ wss2.on('connection', function connection(ws) {
265
264
});
266
267
server.on('upgrade', function upgrade(request, socket, head) {
268
- const { pathname } = parse(request.url);
+ const { pathname } = new URL(request.url, 'wss://base.url');
269
270
if (pathname === '/foo') {
271
wss1.handleUpgrade(request, socket, head, function done(ws) {
0 commit comments