There a limit to the number of channel segments that you can use in a wildcard subscribe. Currently you can have up to three levels deep with your channel segment hierarchies, a.b.c, for example.

Valid wildcard channel names:

  • a.*
  • a.b.*
  • a.b
  • a.b.c

Technically speaking, the last two examples are just single channels without any wildcards, but you can subscribe to any of the above forms.

Invalid wildcard channel names:

  • * - can not wildcard at the top level to subscribe to all channels
  • .* - can not start with a .
  • a.*.b - * must be at the end
  • a. - the . must be followed by a * when it is at the end of the name
  • a* - * must always be preceded with a .
  • a*b - * must always be preceded with a . and .* must always be at the end

NOTE: The above invalid channel names will actually succeed if you attempt to subscribe to them. They will even succeed when you publish to them. But they will operate as literal channel names and not as wildcard channels. So it is highly recommended that you do not use the invalid forms so as not to confuse the intent of the channel names with wildcard behaviors.

Wildcard Channel Publish Errors

As stated above, there are valid wildcard channel names and invalid wildcard channel names and even the invalid channel names can be successfully subscribed to without error and published to and subscribes to those invalid channel names will succeed. But it only works as a single, literal channel name and with wildcard behaviors.

The one exception to this rule is channels with more than two . characters. If you attempt to subscribe to a channel with more than two . characters (more than three segments) it will succeed, but you will not be able to publish to those channels.

  • a.b.c.d - too many segments
  • a.b.c.* - too many segments

If you do attempt to publish to channel names with more than three segments (three or more . delimiters), then you will receive a 400 INVALID error response.