开发者

Ruby on Rails with Faye, how to broadcast data to specific subcsriber

开发者 https://www.devze.com 2023-02-24 08:07 出处:网络
i want to build a Ruby on Rails web-apps where using facebook style notification, for the push server i\'m using FAYE, is there any solution to broadcast notification for specific client, for case stu

i want to build a Ruby on Rails web-apps where using facebook style notification, for the push server i'm using FAYE, is there any solution to broadcast notification for specific client, for case studies in Facebook only your accoun开发者_如何学Ct have notification if somebody send you a message or tag your photo. Thanks


In your client side JavaScript, subscribe to a channel name based on the user (e.g. '/messages/userid_1234') and use that to send private messages from the server.

For security reasons, don't use the actual user ID or even a hash of the username or email, since someone could spoof a subscribe that way. Generate a random GUID on signup for each user and store that with your user's account details.

0

精彩评论

暂无评论...
验证码 换一张
取 消