如果我试图在没有来自节点的angularjs的情况下检索数据:
var socket = io.connect('127.0.0.1:3000');
socket.on("foo", function(message){
console.log(message);
});
node.js文件:
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');
});
它会正常工作......
但是我现在如何使用角度应用程序检索数据?