views:

122

answers:

3

I'm looking for something open source that can "push" messages to connected clients based on their subscription, for example "User 1" might be subscribed to "feed1" and "feed3" and "User 2" might be subscribed to "feed2" and "feed3" etc.

I've got something working using ejabberd but it requires that the server send a message individually to each connected user (User 1, User 2 etc) rather than to the feeds. Is there anything out there that would allow me to do this?

I should mention that the users are a software client, not people so any type of messaging is fine as long as it's push and not polling.

A: 

I've got something working using ejabberd but it requires that the server send a message individually to each connected user (User 1, User 2 etc) rather than to the feeds

I'm not quite sure what you mean about sending a message to a feed, as it's neither XMPP, usenet or atom usage.

The usual mechanism in XMPP for publishing to any user who is interested in a topic is to use publish-subscribe rather than a client maintaining the list of users to send messages to. XMPP is a push based technology, so when a node is updated, the server sends a message to any user registered to that node. So when you publish, you send one message to the server, then the server sends any number of messages to the subscribers. This page describes setting up ejabberd pub-sub.

Atom you publish to the web and users poll, so the users send a message to the server then the server replies with an update. It handles the server end, other software is required for the different users to subscribe to feeds.

(I don't really know how usenet works).

I'd go with XMPP pub-sub; it has mechanisms for what you seem to be wanting, and allows users to subscribed to different 'feeds'. The disadvantage is that it is quite complicated, and which features are implemented vary server to server. You might want to look at the personal event protocol too, which has simplified pub-sub guidelines.

Pete Kirkham
I guess I didn't explain very well. XMPP pubsub is the closest I've found to the answer but it seems that I would need to register each and every pubsub channel (or whatever the term is). I guess my ideal situation would be XMPP pubsub where clients could register interest in a particular topic which may or may not exist and if and when it did exist, they would receive notifications.Is this possible with ejabberd or other XMPP server?
Jason
The protocol doesn't directly allow for that - just like http 404, the server SHOULD report an error if you try and subscribe to a node which doesn't exist. You could have a client detect the error, then create the node, but that would require you to have control of the client. If you do, then that is an option. I don't know if ejabberd has a hook for subscriptions to non-existing nodes that can be used to create one automatically. The other XMPP servers I've used fail your open source criterion.
Pete Kirkham
A: 

This just sounds like an IRC daemon - there's numerous open source ones (I like ircd-hybrid myself).

Your server would create muted (+m) channels for each feed (#feed1, #feed2 and #feed3). Clients would join the channels for the feeds they're interested in, and your server would send messages to the channels to multicast them to interested clients.

caf
A: 

You may want to take a look at zeromq. The was a recent article in Linux Weekly News showing simple examples in multiple languages (since you don't specify which language you want to write this in).

In that article is an example of a publish subscribe application with the ability to do simple filtering such as what you want with your feeds. It also supports multicast so you wont get duplicated traffic on a LAN, and a forwarder so you can reduce traffic to multiple common destinations over a WAN.

camh
I should have mentioned, the listening (subscribing) app will be written in C++ and the publishing application will be a PHP script running under Apache. zeromq looks very promising but I can't find a way to get PHP to send messages into the server.Basically, what I need is something like zeromq with message filters on it so a client could subscribe to "type.subtype.*" for example and when the server broadcasts a message that matches that filter, it goes to the subscribed clients.I wish there was some way to get PHP to send out messages from zeromq, it looks to be exactly what I need.
Jason