users@tyrus.java.net

Multiple Tyrus standalone clients with Undertow

From: Michał Ćmil <cmilmichal_at_gmail.com>
Date: Mon, 16 Jun 2014 09:25:24 +0200

Hello,

I have a strange issue using the Tyrus standalone client (JDK and the
standard one - I also tried the shared client option) and I wonder if I'm
doing something wrong or its a bug.

My setup consists of 2 Undertow server endpoints on WildFly and 2
standalone Tyrus client endpoints. If I run two client instances (separate
processes on the same machine), I get something similar to a "race
condition". Only the first endpoint of the first client is able to RECEIVE
messages, but every client can send them. I can also see, that the server
endpoints are sending the messages to all clients. I checked the setup
using tcpviewer and both instances are creating their connections.

However If I send a message through the channel before launching another
instance, then everything works. Additionally, everything works fine with
different implementations (JS clients).

I create my endpoint using the getWebSocketContainer method:
Session s = ContainerProvider.getWebSocketContainer().connectToServer(new
MultiUserEndpoint(selectionInfos),
new URI("ws://192.168.55.168:8080/rest.research/multiuser"));
UpdateEndpoint ue = new UpdateEndpoint(ops);
Session us = ContainerProvider.getWebSocketContainer().connectToServer(ue,
new URI(
 "ws://192.168.55.168:8080/rest.research/update"));

My dependency:
<dependency>
 <groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client-jdk</artifactId>
 <version>1.7</version>
</dependency>

I would be grateful for any advice on this issue.

Best Regards,
Michał