steffenwt / nodejs-pub-sub-chat-demo Goto Github PK
View Code? Open in Web Editor NEWNode.js + Redis Pub/Sub + socket.io
Node.js + Redis Pub/Sub + socket.io
I have found a bug, lets say a client is connected and chatting and here if we turn off the server and then run it again and then this client tries to send another message on the same page (without refreshing the page), it gives this error in console.
D:\globalchat\nodejs-pub-sub-chat-demo-master\app_redis.js:82
socket.sessionController.publish(reply);
^
TypeError: Cannot read property 'publish' of undefined
at Socket. (D:\globalchat\nodejs-pub-sub-chat-demo-master\app_redis.js:82:28)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at D:\work\Ideas Practical\Projects\globalchat\nodejs-pub-sub-chat-demo-master\node_modules\socket.io\lib\socket.js:513:12
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)
How ti fix this and how to handle crashes and clients reconnection if the server goes down?
I have socket.io , redis and all required dependencies installed but on running I get following error
node app_redis.js
/root/node_modules/nodejs-pub-sub-chat-demo-master/app_redis.js:22
io.configure( function() {
^
TypeError: Object # has no method 'configure'
at Object. (/root/node_modules/nodejs-pub-sub-chat-demo-master/app_redis.js:22:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3
[root@test nodejs-pub-sub-chat-demo-master]# nano app_redis.js
Guys,
i tried to run demo after npm install and then node app.js but seems like demo is not running. Do you guys have any plans to make it work for 2018 updated?
Hi,
You have written in your code:
"// session controller class for storing redis connections
// this is more a workaround for the proof-of-concept
// in "real" applications session handling should NOT
// be done like this"
So how should it stored in real apps ?
I'm having problems when pulling anything out and putting it in a separate file.
The error is: Uncaught SyntaxError: Unexpected token <
Always on the first line.
Can't seem to work around it. Perhaps an error in the JS somewhere? I don't see where.
Are you able to put the JS from this in a separate file?
AFAIK redis doesnt inform anyone if pubsub subscriber is gone.
In your readme you specify to npm install redis socket.io
. Doing this will install the latest versions without a package.json
specifying the versions that are required. Current code base doesn't work with recent versions of socket.io
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.