I have socket.io working locally. http://localhost:3000 is URL for Node.js backend and http://localhost:4200 URL for frontend Angular.
But it does not work when I deploy the app.
Folder structure:
parent-folder-name
-backend folder
-frontend files
All files of Angular located directly in the parent folder.
URLs:
http://mydomainnameexample.com/parent-folder-name/backend
http://mydomainnameexample.com/parent-folder-name/ (frontend)
Code:
Client: this.socket = io('http://mydomainnameexample.com/parent-folder-name/');
Server side:
const http = require('http').Server(app);
const io = require('socket.io')(http);
io.sockets.on('connection', function(socket) {
console.log('A client is connected!');
socket.on('index', () => {
console.log('socketData: ');
testController.index(socket);
});
});
I do have 404 in the console for this URL:
http://mydomainnameexample.com/parent-folder-name/backend/?EIO=3&transport=polling&t=MQnDIEb