paulojjj
paulojjj

Reputation: 51

f:websocket stops working in JSF 2.3 after application redeployment on wildfly

I'm developing a new application using websockets and decided to use JSF 2.3 in wildfly 15. All is working fine until I try to redeploy my code using wildfly management console. Websockets stops working after this point and I can just make it work after a server restart. I made a simple application to test this behaviour with this code in the body of xhtml:

<f:websocket channel="test" />

When the application is redeployed I noticed that my page keeps trying to make requests to websocket endpoint and keeps receiving multiple 101 (Switching protocols) as response code in short intervals (about 5 requests/second).

Firefox network inspection

I used wireshark to capture traffic and discovered that just after this response wildfly send a websocket connection close [FIN].

I tried to narrow down this issue and seems to me like a wildfly bug. I used fresh installations of wildfly 15.0.1.Final and 16.0.0.Final. Does anyone have a workaround or a working solution for this?

Upvotes: 5

Views: 794

Answers (3)

BalusC
BalusC

Reputation: 1108852

This has been fixed in Mojarra 2.3.15 (released May 2021).

It was initially already fixed at May 2019 for the imagined 2.3.10 version via issue 4565 wherein I have backported the fixes from <o:socket> into <f:websocket>. Unfortunately it was done during the Oracle -> Eclipse transition and in hindsight the changes appear to have completely slipped through during the chaos. So it was re-done via issue 4802 for 2.3.15.

Upvotes: 1

user17686583
user17686583

Reputation: 1

This is a bug in the source code. Omnifaces websocket implementation fixed the bug. I would recommend using that.

Upvotes: 0

paulojjj
paulojjj

Reputation: 51

I tested a very simple application on glassfish (with just f:websocket on xhtml - no backing bean, just to test network websocket connection) and couldn't get the same result I had on wildfly (repeated 101 responses), so I thought this wouldn't apply in glassfish (thus unrelated to Websocket PushContext not working anymore after application redeploy)

After reading Kukeltje comment I decided to make a more functional test application and noticed that websocket stopped working on glassfish after reload (but couldn't get multiple 101 responses - as in wildfly).

So this must be related to Websocket PushContext not working anymore after application redeploy

Test application source

Test application WAR

Upvotes: 0

Related Questions