so I'm very new to this Web-Development stuff and I'm currently working on a Tic Tac Toe Multiplayer Game that works perfectly in my local network. Now I bought a Domain for practice and I am stuck on this error:
GET https://backend.MYDOMAIN.games/socket.io/?EIO=4&transport=polling&t=NxFY-hh 404
This is my backend code:
const express = require('express')
const app = express();
const fs = require('fs')
const http = require('http')
const https = require('https');
const { Server } = require('socket.io')
const privateKey = fs.readFileSync('./nodmod2/key.pem');
const certificate = fs.readFileSync('./nodmod2/cert.pem');
const credentials = {key: privateKey, cert: certificate};
const httpServer = http.createServer(app)
const httpsServer = https.createServer(credentials, app)
const io = new Server(httpsServer);
io.on('connection', (socket) => {
socket.send("connected.")
})
app.get('/debug2', (req, res) => {
res.send('Works')
})
httpServer.listen(8080)
console.log("HTTP auf 8080")
httpsServer.listen(3000);
console.log("HTTPS auf 3000")
And this is how I am connecting to it:
const socket = io("https://backend.MYDOMAIN.games/debug2");
socket.on('connect', () => {
displayID(`Your ID: ${socket.id}`)
})
On localhost:3000, this works fine. But not with my domain. What am I missing?