I would like a help with chat using socket.io, I would like to set a URL, I can not, I can only access through localhost: 3000.
For example, I wanted the chat to be on the home page of my site example: siteexample.com, how do I define this? how do I start server.js inside the server?
my code: SERVER.JS
var socket = require( './node_modules/socket.io' );
var express = require('./node_modules/express');
var app = express();
var server = require('http').createServer(app);
var io = socket.listen( server );
var port = process.env.PORT || 3000;
chat.js
var socket = io.connect( 'http://'+window.location.hostname+':3000' );
Another question, how do I define my index, for php?
I made the change in the code below:
app.use(express.static(__dirname + '/'));
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.php');
});
But when you access the site, it automatically downloads the page ...