Advertisement
Guest User

XHR Polling Fail - Server

a guest
May 26th, 2012
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// NODEJS -------------------------------------------------------------------------------
  2.  
  3. var fs = require('fs'),
  4.     url = require('url'),
  5.     http = require('http'),
  6.     querystring = require('querystring');
  7.    
  8. var httpServer = http.createServer(function(req, response){
  9.     fs.readFile('index.html', function(err, data){
  10.         response.writeHead(200, {'Content-Type':'text/html'});  
  11.         response.write(data);  
  12.         response.end();
  13.     });
  14. }); httpServer.listen(8091);
  15.  
  16.  
  17. /// NOWJS --------------------------------------------------------------------------------
  18.  
  19. var nowjs = require('now');
  20. var everyone = nowjs.initialize(httpServer, {   socketio: { transports: ['xhr-polling', 'jsonp-polling'] }, closureTimeout: 6000 });
  21.  
  22.  
  23. /// CONNECTION ---------------------------------------------------------------------------
  24.  
  25. nowjs.on('connect', function(){
  26.     console.log('USER CONNECTION> userID='+this.user.clientId);
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement