-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection hangs on falsy verifyClient result #1572
Comments
I can't reproduce with Chrome 74.0.3729.169 on macOS. 'use strict';
const http = require('http');
const WebSocket = require('ws');
const data = `<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
(function () {
var ws = new WebSocket('ws://localhost:8080');
ws.onopen = function () {
console.log('open');
};
})();
</script>
</body>
</html>`;
const server = http.createServer();
server.on('request', function(req, res) {
res.setHeader('Content-Type', 'text/html');
res.end(data);
});
const wss = new WebSocket.Server({
server,
verifyClient(info, cb) {
cb(false);
}
});
wss.on('connection', function() {
console.log('connected');
});
server.listen(8080, function() {
console.log('Server listening on [::]:8080');
}); |
It turned out that some extension that was installed interfered with WebSocket connection. The strangest thing is that it only occurred when then the connection was refused. Anyway, now it works. Thanks again @lpinca! |
Anyway, my suggestion is to not use the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
At the beginning, I have to say - many thanks for this library.
ws
is the lib of choice and was integrated exclusively with Marble.js framework. 💪The issue is very strange because suddenly it started to occur. The problem is probably with refusing a connection inside
verifyClient
method. If theverifyClient
method refuses connection then the client hangs and timeouts after some time. An interesting fact is that it occurs even in the simplews
server. I typically tested it on Chrome browsers (via some client extensions) and one week ago it worked properly. To be honest I'm not sure if some Chrome update introduced some breaking changes to the WebSocket communication during the handshake phase 🤔Reproducible in:
Steps to reproduce:
Expected result:
Actual result:
Attachments:
The text was updated successfully, but these errors were encountered: