nowjs-sockets

Cannot find module 'now' - nowjs and nodejs

南笙酒味 提交于 2019-12-12 17:05:51
问题 I installed nodejs in my home folder (/home/myname/). No problems so far. Then I installed nowjs and there was one warning: Checking for node path: not found Now when I try this example: http://nowjs.com/doc/example I get the error: node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Cannot find module 'now' at Function._resolveFilename (module.js:334:11) at Function._load (module.js:279:25) at Module.require (module.js:357:17) at require (module.js:368:17)

NowJS cookie field in this.user is empty

假装没事ソ 提交于 2019-12-11 15:23:03
问题 According to these: https://gist.github.com/2266544, Session support in Now.js. This code should return the NowJS clientId, cookie and session: nowjs.on('connect', function() { console.log(this.user); }) However, what I got was: { clientId: 'something', cookie: { } } The cookie field is empty. There is no session entry (which I read is an official problem). Additional Information I am also using ExpressJS, PassportJS, Mongoose, session-mongoose. I initialized NowJS after configuring Express.

How do I Scale Heroku app that uses Nowjs?

主宰稳场 提交于 2019-12-11 07:25:00
问题 Scaling my web app to 2 web proceses on Heroku breaks Nowjs/Sockets.io. I'm using full stack that is new to me and everything works great until I add a 2nd web process. Node.js still responds fine but Nowjs stops responding. I get 503 responds in the browser and GET musicbacon.com/socket.io/1/?t=1339117661910 dyno=web.2 queue=0 wait=0ms service=2ms status=200 bytes=82 2012-06-08T01:07:42+00:00 heroku[router]: Error H13 (Connection closed without response) -> GET musicbacon.com/socket.io/1

Nowjs: [RangeError: Maximum call stack size exceeded]

混江龙づ霸主 提交于 2019-12-10 12:38:39
问题 When I start the server on port 8080 it doesn't give me an error, but when I am trying to browse the http://localhost:8080/nowjs/now.js the server raises an error: [RangeError: Maximum call stack size exceeded] undefined I tried the same with socket.io and it worked fine. 回答1: Hmm, if now.js uses date.js, maybe your issue lies here. What the link says is that date.js tries to set a toString to Date prototype, but when toString is already defined, you get the circular reference mentioned in

now.js - Hello World example - “require not defined”

偶尔善良 提交于 2019-12-10 09:46:27
问题 I'm having trouble getting the now.js chat client tutorial to work. (I've also followed this video almost exactly). server.coffee: fs = require 'fs' http = require 'http' now = require 'now' server = http.createServer (req, res) -> fs.readFile( 'index.html' (err, data) -> res.writeHead( 200 'Content-Type': 'text/html' ) res.end(data) ) server.listen 8080 everyone = now.initialize(server) everyone.now.distributeMessage = (msg) -> everyone.now.receiveMessage(@.now.name, msg) index.html: <html>

Node + now.js + Model-View-Control-Pattern

[亡魂溺海] 提交于 2019-12-07 17:05:56
问题 I'm using a forum software which is based on MVC-Pattern (Templates and PHP-Classes). Pages look like this: domain.com/index.php?page=Test I want to setup a chatserver on one page (domain.com/index.php?page=Chat) with node and now.js. Now I encouter a problem: How to tell the server side code that the chat server has to work at index.php?page=Chat Obviously I can't do something like that: fs.readFile('index.php?page=Chat') Any ideas how to setup a node server on URLs like that? Thanks! 回答1: I

Node + now.js + Model-View-Control-Pattern

隐身守侯 提交于 2019-12-05 21:26:50
I'm using a forum software which is based on MVC-Pattern (Templates and PHP-Classes). Pages look like this: domain.com/index.php?page=Test I want to setup a chatserver on one page (domain.com/index.php?page=Chat) with node and now.js. Now I encouter a problem: How to tell the server side code that the chat server has to work at index.php?page=Chat Obviously I can't do something like that: fs.readFile('index.php?page=Chat') Any ideas how to setup a node server on URLs like that? Thanks! I would dive a little deeper into node.js. As node is itself a webserver, you have to learn a little about

now.js - Hello World example - “require not defined”

冷暖自知 提交于 2019-12-05 20:56:52
I'm having trouble getting the now.js chat client tutorial to work. (I've also followed this video almost exactly). server.coffee: fs = require 'fs' http = require 'http' now = require 'now' server = http.createServer (req, res) -> fs.readFile( 'index.html' (err, data) -> res.writeHead( 200 'Content-Type': 'text/html' ) res.end(data) ) server.listen 8080 everyone = now.initialize(server) everyone.now.distributeMessage = (msg) -> everyone.now.receiveMessage(@.now.name, msg) index.html: <html> <head> <title>nowjs title</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax

Node: Scale socket.io / nowjs - scale across different instances

空扰寡人 提交于 2019-12-05 15:57:53
问题 Before starting to write my application I need to know what to do when a single node.js instance (express and (socket.io or nowjs)) isn't enough anymore. You might tell me now, that I shouldn't care about scale until it's about time but I don't want to develop an application and run into trouble because you can't easily scale socket.io or nowjs across multiple instances. I recently read that socket.io now supports a way to scale using Redis (which I also have no experience in). Nowjs is build

Enhancing Security in a now.js/socket.io chat

拟墨画扇 提交于 2019-12-04 12:32:53
问题 A chat with nowjs or socket.io is one of the easiest exercises you can perform with them. I want to implement a multi-room chat (with a non-fixed number of rooms and logged users), using nowjs' Group objects. I've not worked with WebSockets directly, yet, and I want to know what security concerns are there. For example, how often do I have to check for authentication? Is it possible for an attacker to "hijack" a socket.io connection and how can I prevent it? What other security traps are