I'm building a webchat with Spring Boot, RabbitMQ and WebSocket as POC, but I'm stucked a the last point: WebSockets
I want my ws clients to connect to a specific endpoint, like /room/{id}
and when a new message arrives, I want the server to send the response to clients, but I searched for something similar and didn't found.
Currently, when the message arrives, I process it with RabbitMQ, like
container.setMessageListener(new MessageListenerAdapter(){
@Override
public void onMessage(org.springframework.amqp.core.Message message, Channel channel) throws Exception {
log.info(message);
log.info("Got: "+ new String(message.getBody()));
}
});
what I would like is, instead log it , I want to send it to the client, for example: websocketManager.sendMessage(new String(message.getBody()))