Socket.io tutorial update

I have found out that the info in the socket.io tutorial (the one here https://developer.playcanvas.com/en/tutorials/real-time-multiplayer/) is old. It only works in version 2.0.4.
Here is the problem:
This is the code that the tutorial uses for the server:

var server = require('http').createServer();
var io = require('socket.io')(server);

io.sockets.on('connection', function(socket) {
    console.log("Client has connected!");
});

console.log ('Server started.');
server.listen(3000);

But if you look here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0, it says you have to handle the CORS for remote connection in version 3.
I respectfully ask that you update the tutorial so that people don’t get confused. Thank you and have a great day! :smile:

3 Likes