I would like to know what are the differences between
var socket = io();
and
var socket = io.connect();
using socket.io in my script (client side)
Thank you!
I would like to know what are the differences between
var socket = io();
and
var socket = io.connect();
using socket.io in my script (client side)
Thank you!
Share Improve this question asked Aug 5, 2017 at 11:48 AidoruAidoru 5651 gold badge5 silver badges16 bronze badges1 Answer
Reset to default 17There is no difference.
If you look at the source code for the SocketIO client, io
is declared as follows:
module.exports = exports = lookup;
And io.connect()
is declared in the same way:
exports.connect = lookup;
They both refer to the same (internal) function lookup
.
I think that io.connect
exists to make the client backward patible with older versions of SocketIO.