[英]Socket.io with angular
I am trying to implement socket.io
with angular
client. 我正在尝试使用angular
客户端实现socket.io
。 Lets say I am having 3 routes for my application. 可以说我有3条路线可供申请。
http://localhost:4000/#/abc http://本地主机:4000 /#/ abc
Here I am emitting file processing status from backend to client. 在这里,我从后端向客户端发出文件处理状态。 I only want to display the status to the users who are all in route 3. What is the best way to achieve this in angular? 我只想向所有在路线3中的用户显示状态。以最佳方式实现此目标的最佳方法是什么?
node.js node.js
io.emit('Test', {
Test: "Test"
});
javascript javascript
socket.on('Test', function (data) {
console.log(data);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.