i need you solution for an session based auth but your syntax is fail or too old :(
I hafe your script 1 to 1 copy paste and tested...
The initalitation of servers is other as my own script and your get an error by init... :(
Line #4 app = express.createServer()
get: createServer() is undefined....
my server will be init on this lines:
// Require HTTP module (to start server) and Socket.IO
var http = require('http');
var io = require('socket.io');
var express = require('express'); // need on hs
var port = 8080;
// Start the server
var server = http.createServer(function(req, res){
// Send HTML headers and message
res.writeHead(200,{ 'Content-Type': 'text/html' });
res.end( console.log('
Hello Socket Lover!
') );
});
server.listen(port);
// Create a Socket.IO instance, passing it our server
var socket = io.listen(server);
// Add a connect listener
socket = socket.of('/root'); // set namespace
socket.on('connection', function(socket){
/* my stuff /
});
Hello,
i need you solution for an session based auth but your syntax is fail or too old :( I hafe your script 1 to 1 copy paste and tested... The initalitation of servers is other as my own script and your get an error by init... :(
Line #4 app = express.createServer()
get: createServer() is undefined....
my server will be init on this lines:
// Require HTTP module (to start server) and Socket.IO var http = require('http'); var io = require('socket.io'); var express = require('express'); // need on hs var port = 8080;
// Start the server var server = http.createServer(function(req, res){ // Send HTML headers and message res.writeHead(200,{ 'Content-Type': 'text/html' }); res.end( console.log('
Hello Socket Lover!
') ); }); server.listen(port);// Create a Socket.IO instance, passing it our server var socket = io.listen(server);
// Add a connect listener socket = socket.of('/root'); // set namespace socket.on('connection', function(socket){ /* my stuff / });