fastly / pushpin

A proxy server for adding push to your API, used at the core of Fastly's Fanout service
https://pushpin.org
Apache License 2.0
3.66k stars 153 forks source link

wildcard subscriptions #47635

Open jkarneges opened 8 years ago

jkarneges commented 8 years ago

It would be useful to subscribe to channels by wildcard. For example, a publisher could publish a message to channel A.B.C, and a receiver with subscription to A.* could receive the message.

Wildcard subscriptions are not uncommon in publish-subscribe systems, however they tend to work differently in each system. For example, ZeroMQ supports filtering by prefix. Bayeux supports segmented channels and trailing wildcards of either single segment or multi-segment (e.g. /a/* matches /a/b, and /a/** matches /a/b/c/d). At least in these two cases, wildcarding is effectively suffix only, which is pretty conservative and seems like something we could reasonably do in Pushpin.

Proposal:

Note that ZeroMQ being limited to filtering by prefix doesn't necessarily mean that we can't support more complex wildcarding. For example, a mid-string wildcard like foo*bar could be supported by setting the SUB socket to use foo as the filter, but then only deliver to clients if the full expression matches. However we should only implement something like this if there is a real need. For most applications needing wildcards, suffix-only is usually enough.

jkarneges commented 8 years ago

Some more notes: