So… for some reason I can’t get socket.io to work with glitch. I am very new to glitch and just tried to recreate a program i have made on my pc.
This is the socket io script in my html file.
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
This is how i require socket io on server.js
var express = require("express");
var app = express();
var serv = require("http").Server(app);
var io = require("socket.io")(serv);
app.use(express.static('public'));
app.get('/', function(request, response) {
response.sendFile(__dirname + '/views/index.html');
});
const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
The server runs without any errors but when i try to open a client, socket io can’t connect to the server.
I have no idea what i’m doing wrong. any help is appreciated