I want to write application that make messaging between users, Messages that send between users is in 3 types
My application will save messages in RDBMS. When new message send and receiver user is online ,my app will notify to user that new message receive , I decided to write my application using Spring Websocket and Stomp .My application using spring security and and i want show online users in group and direct for each other member my question is know how many endpoint and broker i need ? and how can do that.
Update:
My application is similar gitter and slack , when user login messages may receive from direct or group or channel. when i switch between users and group or channel i will unsubscribe from last and subscribe to user or group that i chat in .i dont know subscribe and unsubscribe is correct or just one subscribe for all . is this usage correct or not?
chatSocket.subscribe("/user/exchange/direct/chat.message/{userId}", function(message) {});
chatSocket.subscribe("/topic/group/chat.message/{groupId}", function(message) {});
An option to store messages could be adding a channel interceptor. Make users subscribe to an app destination when the websocket connection is established and send the stored messages sent while he was online.
This sample application could give you some hints: https://github.com/salmar/spring-websocket-chat