javascript - How to retrive data with angularjs from node emit? -


if try retrive data without angularjs node this:

var socket = io.connect('127.0.0.1:3000'); socket.on("foo", function(message){    console.log(message);       }); 

node.js file:

var app = require('express')(); var http = require('http').server(app); var io = require('socket.io')(http); var redis = require('ioredis'); var redis = new redis(); redis.subscribe('update.group', function(err, count) { }); redis.on('message', function(channel, message) {     message = json.parse(message);     console.log(message);     io.emit('foo', message); }); http.listen(3000, function(){     console.log('listening on port 3000'); }); 

it work fine...

but how can retrive data angular app?

your problem how use socket.io angular, take @ this module


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -