Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3694

Does Quarkus provides any solution for joining websockets together like in socket.io?

$
0
0

ProblemI am currently working on a JAVA Quarkus backend and I am trying to solve the problem of communtication between users in different so called "rooms" like socket io does it with joining the sockets together (https://socket.io/docs/v3/rooms/.

Room architecture

Basically I want to implement the functionality shown in the image above in Quarkus with WebSockets.

What have I tried?I have found a web-socket solution on the official quarkus website (https://quarkus.io/guides/websockets) but with the provided solution, there is no way to join the websockets together and create these "rooms"/lobbies like in socket io.

The provided code block has a single session for every user:

Map<String, Session> sessions = new ConcurrentHashMap<>();    @OnOpen    public void onOpen(Session session, @PathParam("username") String username) {        broadcast("User " + username +" joined");        sessions.put(username, session);    }

The architecture of the provided quarkus websocket solution looks like this:

Single session-architecture

My questions

  • Is there a way to join a different session together or to create a custom session by PathParams?
  • Are there any useful Java libraries providing such lobby/room/join functionality equivalent to socket.io in js?
  • Is the provided code somehow changeable to achieve the goal?

Viewing all articles
Browse latest Browse all 3694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>