Answer the question
In order to leave comments, you need to log in
Why does an error occur when connecting to socket io?
We have the following server code:
var https = require('https'),
fs = require('fs');
const opts = {
key: fs.readFileSync('/home/admin/conf/web/ssl.key'),
cert: fs.readFileSync('/home/admin/conf/web/ssl.crt')
}
var app = https.createServer(opts);
var io = require('socket.io').listen(app);
app.listen(8091, function(){
console.log("HTTPS on port " + 8091);
})
var socket = io.connect(':8091');
Answer the question
In order to leave comments, you need to log in
The problem is in the old version of socket io client-side))) Thank you all for your help.
Look at this example. The example itself may not be very good, but the socket is attached well.
You should try to use standard ports (80,443) whenever possible, since all others can be blocked on the client. The example uses ports 5000,5001, but they can be easily changed to the ones you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question