I have no problem with web sockets in 8.5.14
On 20/10/2017 11:23, Mark Thomas wrote:
On 20/10/17 09:49, Christoph Mertins wrote:
Hello,
I have performed a downgrade to 8.0.14 on Raspbian and now it is working like
it should.
So something change between these versions in the area of the Websockets.
If you are able to identify in which version the problem starts that
would be very helpful. Keep in mind it might be 8.5.x specific or it
have been introduced in both 8.0.x and 8.5.x.
Mark
Kind Regards,
Christoph
Am 19.10.2017 um 16:48 schrieb Christoph Mertins <c.mert...@gmail.com>:
Hello,
after waiting 35 minutes suddenly some events get forwarded for a second or two
and then again silence.
This is really strange.
Kind Regards,
Christoph
Mit freundlichen Grüßen
Christoph Mertins
On Thu, Oct 19, 2017 at 10:21 AM, Christoph Mertins <c.mert...@gmail.com
<mailto:c.mert...@gmail.com>> wrote:
Hello,
I have a problem with Tomcat only sending the first message to the client and
then no message anymore till the client reconnects.
The code was working for some versions but then stopped working:
public void handleEvent(EventObject eventObject) {
Enumeration<String> keySet = userSessions.keys();
while (keySet.hasMoreElements()) {
String key = keySet.nextElement();
Session session = userSessions.get(key);
synchronized (session) {
if (session.isOpen()) {
try {
Semaphore semaphore = new
Semaphore(1);
Async async =
session.getAsyncRemote();
SendHandler handler = new
SemaphoreSendHandler(semaphore, async);
String text =
eventTranscoder.encode(eventObject);
LogManager.getLogger(this.getClass())
.info("Eventbus Sending to " +
session.getId() + " key: " + key + " text: " + text);
if
(async.getBatchingAllowed()) {
async.setBatchingAllowed(false);
}
semaphore.acquireUninterruptibly();
async.sendText(text, handler);
async.flushBatch();
//
session.getBasicRemote().sendObject(eventObject);
} catch (IllegalStateException |
EncodeException | IOException e) {
LogManager.getLogger(this.getClass()).info("Sending failed", e);
// userSessions.remove(key);
}
} else {
LogManager.getLogger(this.getClass()).info("Session not open" + key);
// userSessions.remove(key);
}
}
}
}
private class SemaphoreSendHandler implements SendHandler {
private final Semaphore semaphore;
private RemoteEndpoint remoteEndpoint;
private SemaphoreSendHandler(Semaphore semaphore,
RemoteEndpoint remoteEndpoint) {
this.semaphore = semaphore;
this.remoteEndpoint = remoteEndpoint;
}
@Override
public void onResult(SendResult result) {
LogManager.getLogger(EventBusEndpoint.class).info("Eventbus
Sent ok: " + result.isOK());
try {
remoteEndpoint.flushBatch();
remoteEndpoint.sendPing(ByteBuffer.wrap(new
byte[0]));
} catch (IOException e) {
LogManager.getLogger(this.getClass()).info("Flushing failed", e);
}
semaphore.release();
}
}
I can see the SemaphoreSendHandler putting out a true for the result.isOK()
call.
But I can’t see any network traffic and no message on the client side. I am
checking the with a Chrome Extension (Simple Web Socket Client) on Chrome 61
and 62.
Versions:
Tomcat 8.5.21
Java: Oracle JDK 1.8 151 (tested 131 too)
OS: Raspbian Stretch
I cannot see any reason why this is not working.
Kind Regards,
Christoph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
.
--
Riccardo Cohen
+33 6 09 83 64 49
E5Group
http://www.5flow.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org