I am new to web-sockets in Java. I was able to create a web-socket, but I want to be able to open multiple different sockets based on the channel (room). Please note that I do not use STOMP.
I have tried adding a dynamic url as such: "/{someRoom}/chat", but when testing with multiple clients directing to different URLs they were all connecting to the same socket. Essentially my question is: is it possible to open new sockets dynamically? is this the right methodology or should I have them all use the same socket and route their messages based on the URL provided?
@EnableWebSocket
@Controller
public class WebSocketConfig implements WebSocketConfigurer{
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(alertsHandler(), "/{someRoom}/chat").setAllowedOrigins("*")
.addInterceptors(new HttpSessionHandshakeInterceptor()).withSockJS();
}