Affects: 6.0.x

I have something similar to this:

@SubscribeMapping("/chat")
fun onSubscribeSendChat() =
    chatMessages

@SubscribeMapping("/users")
fun onSubscribeSendUsers() =
    currentUsers

I have a client that connects and subscribes to /*. My intention is for this newly connected client to receive this initial state to initialize it. However, it seems that @SubscribeMapping("/some-topic") isn't called when the client subscribes to some-topic by wildcards.

Comment From: bclozel

I think this is by design. As stated in the reference documentation for @SubscribeMapping, this annotation is designed for "one-time request-reply exchange", where the client receives a one-time response to a subscription request.

In this case, matching many if not all @SubscribeMapping routes would yield an undefined behavior. How would the client differentiate the multiple responses received at once? How should we guarantee ordering? What if one of them results in an error, how should we process error handling in this case?

If you would like to send initialization data to a client at startup, I believe you should have one or more dedicated routes and reply accordingly.

I'm closing this issue as invalid as a result.