I have a little web app which applies some AngularJS and php for some functions and some queries from the database(xampp's Apache and mySQL). Now I want to apply to a simple chat in the web app and I do not know how to configure nor what ports and so on.
Following something similar to http://socket.io/get-started/chat/
I have index.js as such
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
});
io.on('connection', function(socket){
console.log('a user connected');
socket.on('disconnect', function(){
console.log('user disconnected');
});
});
http.listen(443, function(){
console.log('listening on *:443');
});
I am trying port 443 and 80, but they doesnt seem to work (xampp shows 80 and 443, no idea how ports work)
my JS file then has var socket = io();
In my browser console , I'm getting something like
socket.io-1.2.0.js:2 GET http://localhost/socket.io/?IO=3&transport=polling&t=1465649664392-0 404 (Not Found)
How do I resolve this problem? I am expecting output such as a user connected
in the cmd after running node index.js
but I do not.
I followed the example for the chat, and it works fine without xampp.