How to send out an Ajax Push to a particular client on a channel?
I wanted to send out data to a specific client on a channel using the Ajax Push mechanism. Here's my design: I have say 10 clients subscribed to Channel #1, and 10 more subscribed to Channel #2. I want to send out an Ajax Push when some particular parameter is updated in my database. I want to send it out to say client #7 on Channel #1. In Ajax Push,I know I can send out the Push to all 开发者_JAVA技巧subscribers of Channel #1. Is there any way to send out the Ajax Push to ONLY client #7 on Channel #1? Thanks, Thothathri
You really do what do have a separate channel for each user. Channels are very cheap with WebSync; even if there was a built-in way to send data to a specific user, it would be implemented exactly in that manner. Having 1000 channels is not a big deal; recently I had a discussion with one user who had something like 10,000 channels per connected client (which is pretty extreme, to be fair), but was working without a hitch.
Simply create a channel such as /user/{username} and use that to push to that user specifically, and you'll be good to go.
精彩评论