I am using Spring boot 2.5.0 with the react front end. Trying to use RSocket for building a chat application.
Came across the following links. But, still not clear on sending message to a particular user.
RSocket doc --> https://docs.spring.io/spring-framework/docs/5.3.8-SNAPSHOT/reference/pdf/rsocket.pdf
Medium --> https://medium.com/swlh/building-a-chat-application-with-angular-and-spring-rsocket-3cd8013f2f55
RSocket Demo -> https://github.com/benwilcock/spring-rsocket-demo/blob/master/rsocket-server/src/main/java/io/pivotal/rsocketserver/RSocketController.java
My application is a multi tenant application. Each tenant might have 3 to 10 users.
Use cases, For any given tenant,
- Store messages in the server
- Should be able to list the users online
- Send message to all users belongs to a particular tenant
- Send message to a particular user from a tenant
I have the following config.
In build.gradle,
implementation 'org.springframework.boot:spring-boot-starter-rsocket'
application.properties,
spring.rsocket.server.mapping-path= /rsocket
spring.rsocket.server.transport= websocket
RSocketController.java
@MessageMapping("fire-and-forget")
public Mono<Void> fireAndForget(final Message request, @AuthenticationPrincipal UserDetails user) {
return Mono.empty();
}
Here, I am able to get the user message and need to route this to a particular user/users. How can I find all users online and route message to a particular user/users?