簡體   English   中英

javascript-如何從節點發射使用angularjs檢索數據

[英]How to retrive data with angularjs from node emit?

如果我嘗試像這樣從節點檢索沒有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');
});

會很好...

但是,現在如何使用角度應用程序檢索數據?

您的問題真的是如何將socket.io與angular一起使用,看看這個模塊

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM