'Socket IO returning error client side with polling.js
So I have this web application that is am moving to my personal website but I've been encountering a few errors and I haven't been able to find a solution for this one:
For some reason I get
polling.js:311 GET https://kayden.dev/socket.io/?EIO=4&transport=polling&t=O35Ebas 404
on the client side that appears every few seconds.
My code does need some cleaning up so I won't be showing everything but here. The server side code looks something like this:
const http = require('http');
const express = require('express');
const socket = require('socket.io');
const path = require('path');
let app = express();
let port = app.get('port');
let users = [];
let amountOnline = 0;
//send static files from public to the client
let server = app.listen(port, function(){
console.log('listening to requests on port '+ port);
});
//first parameter is the /whatever that goes after the url
app.use("/skyfighters", express.static(__dirname + '/public/'));
//setup socket
let io = socket(server);
io.serveClient(true);
And the client side code only has let socket = io.connect();
that actually executes at the moment with this error happening
Any help is appreciated, this is the first time I migrate a node app the a web server so I'm quite unfamiliar with it.
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
