node.js - nodejs cluster - socket.io-emitter send data to specific client -


मैं nodejs - socket.io अनुप्रयोग nodejs क्लस्टर के साथ बना रहा हूँ।

socket.io-redis < / P>

  var ioredis = आवश्यक ('socket.io-redis'); Io.adapter (ioredis ({host: config.redisIp, पोर्ट: config.redisPort}));  

socket.io-emitter

  var io = आवश्यकता ('socket.io-emitter') ({host: settings.redisIp, पोर्ट: सेटिंग्स .redisPort}); Io.emit ('परीक्षा', 'परीक्षण');  

इसका काम करता है, लेकिन सभी जुड़े कुर्सियां ​​भेजना। मैं कमरे के प्रकारों के बिना विशिष्ट ग्राहक कैसे चुन सकता हूं? जैसे,

  io.to ({_ id: user._id})। Emit ('test', 'test'); //यह काम नहीं है। कनेक्ट ईवेंट पर socket._id सिंक्रनाइज़।  

socket.io क्लस्टर ऐप पर विशिष्ट क्लाइंट के लिए कोई भी विचार?

इसे आज़माएं:

  var io = require ('socket.io-emitter') ({host: settings.redisIp, पोर्ट: settings.redisPort}); Io.to (socketId) .emit ('परीक्षण', 'परीक्षण');  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -