Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter some subscribers when sending a message #43

Open
wandenberg opened this issue Aug 6, 2012 · 6 comments
Open

Filter some subscribers when sending a message #43

wandenberg opened this issue Aug 6, 2012 · 6 comments

Comments

@wandenberg
Copy link
Owner

Add a way to publish a message to a specific user using filters, like in the example bellow.

The publish could look like /publish?Channel=B&filter=[{key=userid, val=12345}]&limit=1

Only first user matching userid=12345 on B channel would get the message.

@RyanChiu
Copy link

RyanChiu commented May 1, 2013

wondering if this feature has been added? Or if I want to send messages like trade information to specific uses. Should i have them each listen to a different channel? How can I protect the chanel?(I would imagine client sends back a session id to authenticate, but can publisher be configured to call a php script?

@RyanChiu
Copy link

RyanChiu commented May 1, 2013

or we use session id as channel id?

@wandenberg
Copy link
Owner Author

Hi,

this feature isn't implemented yet. You can connect the subscribers to a general channel to receive common messages and to a second channel to receive "private" messages, using a single connection, take a look on docs for this.
About protection, the module don't care about it. Some solutions I saw being used are:

  • use the access key module, or
  • set a public location that does the security, using php or another language, and than make a internal redirect to the subscriber location that has the "internal" directive on it.

@RyanChiu
Copy link

RyanChiu commented May 2, 2013

Sorry I couldn't figure the documentation:) I am guessing I can just do
addChannel(public) and addChannel(private_ch) to subscribe to two channels? (underlying I am guessing you are using one long poll connection).
BTW, another question, I am using pushstream.js. But the default behavior seems to not send back last message. What's the best practice here? I first make a normal http request to get, say, last 5 messages and then register listeners through pushstream.js?
Thanks so much for such a great tool! I am sending my donation right awy!

@RyanChiu
Copy link

RyanChiu commented May 2, 2013

never mind. figured out if i turn push_stream_store_messages on then i got the last couple of messages.

@wandenberg
Copy link
Owner Author

Hi,

yes, you have to set the store_messages to on and set how many old messages you want, if using stream connections, or set the seconds ago if using long polling, something like that:

//stream
pushstream = new PushStream(your_config);
pushstream.addChannel(public, {backtrack:5});
pushstream.addChannel(private_ch, {backtrack:10});
pushstream.connect();

//long polling
pushstream = new PushStream({
secondsAgo: 10,
other_options
});
pushstream.addChannel(public);
pushstream.addChannel(private_ch);
pushstream.connect();

The modes pushstream.js uses to connect can be set on the options "modes", the default is try in order, eventsource, websocket, stream and longpolling.

@wandenberg wandenberg modified the milestone: 0.4.x Jan 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants