Started following a tutorial for networking for my unity game (not done this before).
It's so far created some really simple script which can be connected to. Here's what I have:
var io = require("socket.io")(process.env.port || 3000);
console.log("Server Started");
io.on("connection", function (socket) {
console.log("Client Connected");
});
In Unity, I have a gameobject with a Socket IO Component (from an asset on the store) on it. From CMD, I run the local version of server.js (code above), and see "Server Started" appear. In Unity, the GameObject has its URL set to: ws://127.0.0.1:3000/socket.io/?EIO=4&transport=websocket, and when I play unity, it connects. This is shown with "Client Connected" appearing in the cmd window.
The tutorial doesn't go into how you might deploy anything like this, so I was just making sure it was going to definitely work before I continue.
I created a digital ocean droplet, with Node.js on. I navigated to srv/www, and installed express as well as socket.io, like I did locally. I uploaded (via ftp) server.js to the location, and ran it. I saw the "Server Started" appear. When I change the IP address in the URL in unity, maintaining the port and everything after it etc, and press play, it doesn't appear to connect. I never see any "Client Connected" message.
It feels like the final hurdle, but I can't work around it.
Have I put things in the wrong directory? What am I doing wrong, why is it not connecting?