nowjs-sockets

codeigniter nodejs and nowjs integration

ぐ巨炮叔叔 提交于 2019-12-04 11:52:28
I am trying to integrate nodejs and nowjs with codeigniter framework, As I dont have time to rewrite the whole site I want to check if a user is logged in. I am using ion_auth and I am storing the session in db. Client js: var session_id = $.cookie('sc_session'); $("form").submit(function() { now.distributeMessage($("textarea").val(),session_id); }); now.receiveMessage = function(message){ $("body").append("<br>" + message); }; Heres the nodejs server code: EDIT :* Simplified it a little, and get session cookie from client js * everyone.now.distributeMessage = function(message,session_cookie)

socket.io as a client

北战南征 提交于 2019-12-04 04:45:25
is there any way to run socketio as a client(not a browser, but a nodejs script) I need to broadcast data from a server to some clients (browsers) and to another linux machine (only running nodejs to get variables, no browser) Any ideias is welcome Regards There is a project on github which implements a socket.io client. Take a look here: https://github.com/remy/Socket.io-node-client var socket = new io.Socket('localhost', 8000); socket.on('connect', function () { console.log('yay, connected!'); socket.send('hi there!'); }); socket.on('message', function (msg) { console.log('a new message came

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

南楼画角 提交于 2019-12-04 01:51:42
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 on to of socket.io - does it work the same way? On nowjs.org you can read that a "distributed version

Send message from server to client with dnode

青春壹個敷衍的年華 提交于 2019-12-03 13:36:43
问题 A couple of month ago I discovered nowjs and dnode and finally used nowjs (and https://github.com/Flotype/nowclient) for client / server bidirectional communication. nowclient enables nowjs communication between 2 node processes (instead of between a node process and a browser for nowjs out of the box). I was then able to send data from the client to the server and from the server to the client. I now use node 0.6.12 and it's kind of painful to use node 0.4.x to run the client. I'm giving a

502 Bad Gateway when using ExpressJS with nginx

ぃ、小莉子 提交于 2019-12-03 06:25:07
If I run my expressjs app like so: coffee server.coffee and navigate to localhost:8080 , everything works just fine. However, when I reverse proxy 8080 with nginx with the following configuration: server { listen 0.0.0.0:80; server_name localhost; access_log /var/log/nginx/nodetest.log; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://node/; proxy_redirect off; } } upstream node { server 127.0.0.1:8080; } I get the following error in the

Session support in Now.js

非 Y 不嫁゛ 提交于 2019-12-01 12:38:07
Now.js quotes: Simply pass a connect or express http server in nowjs.initialize and this.user.session should be available. So: express = require 'express' app = module.exports = express.createServer() connect = require 'connect' nowjs = require 'now' everyone = nowjs.initialize(app) The output of this.user is: { clientId: '353725111301231610', cookie: { 'connect.sid': 's0meC00k1e1nF0rm4ti0n' }, session: undefined } Any idea why session is undefined? I ran into this problem and turns out it was happening because I was initializing NowJS before configuring express. app.configure(function(){ ...

codeigniter & node js integration with now js - how to access view files

自闭症网瘾萝莉.ら 提交于 2019-11-30 07:37:20
i want to integrate codeigniter and node.js but i am having confusion that how to execute both node.js and codeigniter. I have successfully installed and ran the nowjs sample: http://nowjs.com/doc/example how to access view files of codeigniter(or any php framework) into node.js. i have confusion because codeigniter executed with url http://localhost/xyz while node.js executed with http://localhost:8080/xyz so which url i have to write in browser from which i can use both node.js & codeigniter? Here is how ii made codeigniter and nodejs talk to each other. i have my codeigniter app running on

How to use backbone.js with websockets/socket-io/nowjs

萝らか妹 提交于 2019-11-29 19:39:03
I am just getting into backbone.js and am finding progress a little slow. My main problem is working out how to keep my client and server side models in sync using socket-io (technically I am using now.js but the same principal should apply). I think the best way is to override the sync method but some simple advice would be really welcome. Simply overwrite Backbone.sync so that it sends messages down socket.io and tells the relevant backbonejs models on the server to alter state. The interesting part of this solution is setting up the master-master relationship. You need to insure that for

How to use backbone.js with websockets/socket-io/nowjs

偶尔善良 提交于 2019-11-28 15:25:29
问题 I am just getting into backbone.js and am finding progress a little slow. My main problem is working out how to keep my client and server side models in sync using socket-io (technically I am using now.js but the same principal should apply). I think the best way is to override the sync method but some simple advice would be really welcome. 回答1: Simply overwrite Backbone.sync so that it sends messages down socket.io and tells the relevant backbonejs models on the server to alter state. The