Massively simplified & improved pub/sub
Pub/sub is now a lot more predictable and always guarantees strict ordering inside topics, across topics and between WebSocket::send and WebSocket::publish / App::publish. Subscription and unsubscription is always guaranteed to be strictly ordered with respect to publish. Support for MQTT wildcards has been removed.
Backwards compatible
Unless you're relying on MQTT wildcards ('#', '+'), v20.0.0 is entirely backwards compatible with v19.9.0.
Motivation
When pub/sub was introduced in 2018, it was designed based on a few assumptions:
- SHARED_COMPRESSOR being preferred by customers and customers being okay with supporting many application-level messages wrapped in and delivered as one bigger WebSocket message.
- Expectation: Customers being willing to optimize the application protocol to minimize compression overhead.
- Reality: This is way too complicated for customers and not even backwards compatible with their existing protocols. Customers simply want things to work, and they heavily prefer DEDICATED_COMPRESSOR.
- Subscription and unsubscription to/from topics being "malleable" and not strictly ordered.
- Expectation: Customers being fine with subscriptions and unsubscriptions being executed in as big of a batch as possible, with minor re-ordering of messages not being a problem.
- Reality: Many apps depend on a strict ordering guarantee and break down if order is not guaranteed. This is why the nonStrict hack was added, which performs really bad in worst-case and is badly understood.
- WebSocket::send and WebSocket::publish being two different streams out of order with each other.
- Expectation: There being a separate use for pub/sub, not related to send.
- Reality: Customers expect WebSocket::publish followed by WebSocket::send to be delivered in order, and the opposite likewise.
- MQTT syntax being useful
- Expectation: Efficient use of a logarithmic tree of topics and wildcards
- Reality: Customers don't care