Adrian Ber
Adrian Ber

Reputation: 21380

Spring websockets and group messages

I would like to implement a chat using Spring websockets. What will be the best way to implement groups?

In both options I was taking into account that I will register the group to which the user belongs into session attributes.

Upvotes: 2

Views: 1098

Answers (1)

Adrian Ber
Adrian Ber

Reputation: 21380

I ended up creating a destination like "/topic/group/{name}/message" managed by message broker and have user subscribed to it. To send a message you can either send it to the same destination or you can send it to a destination like "/app/message" and have it forward it from there. The latter option has the advantage that you can filter the message.

Upvotes: 2

Related Questions