Skip to main content
SteNe99
Participant
November 18, 2022
Question

ColdFusion WebSocket sometimes handshake timed out

  • November 18, 2022
  • 3 replies
  • 1153 views

Hello,

we have a strange problem with the ColdFusion Built-in WebSocket Server. I really hope that you can help me.

We have already used the Built-in WebSocket Server in ColdFusion 2016 and had no problems.
After the update to ColdFusion 2018 we have the problem that sometimes the handshake fails.

We have opened all the required ports:
8579 (WebSocket port)
8543 (SSL port)

But it can't be due to a port or our certificate, because sometimes the connection can be established.

We have about 200 subscribers a day and about half of them can't connect. The error message appears in the console: "WebSocket connection to 'wss://[..]:8543/cfusion/cfusion' failed: WebSocket opening handshake timed out."
If I then reload the page a few times, it eventually works.

Do you have any ideas what we can try?
Do we need to adjust something in the "server.xml" under "ColdFusion2018\cfusion\runtime\conf"?

Thank you for any help you can offer!

This topic has been closed for replies.

3 replies

Charlie Arehart
Community Expert
Community Expert
December 9, 2022

SteNe, did you ever resolve this? I had meant to offer a reply that day but lost track of it, and just came across your thread here again.

 

While you may be thinking this is some change in behavior or bug in CF (since it "worked on cf2016 and fails only sometimes in cf2018"), I have a different thought: maybe it's simply that the incoming request hangs up simply because CF is itself momentarily unable to respond. There can be all kind of reasons that CF can't respond (even to a web request, let alone a websocket request).

 

Do you have any sort of monitor on CF, whether the CF PMT (new with CF2018) or FusionReactor? Or did you at least try to run any other cfm or cfc at the same time?

 

And even if SOME other requests for a CFM (or CFC via http/https) may "work", does a call to the one involved in the websocket communication respond, if called directly?  It could be that something about THAT request--or something about THAT app, or perhaps even the database table used by that request--might be momentarily unresponsive.

 

Or of course this COULD be some other problem, NOT really about CF but perhaps even about the JVM, especially since you refer to using ssl/tls.

 

Finally, had you considered using the websocket proxy feature (introduced in CF11) where instead of having your clients point to those websocket ports for CF, you instead have their requests go through your web server (IIS or Apache), which then passes them to CF? If you do that, then the ssl/tls termination can happen there, and the communications from the web server to CF would NOT be ssl/tls-based. Even if it's not "how you want to work", it could be interesting to find if that WOULD work when your current approach does not.

/Charlie (troubleshooter, carehart. org)
BKBK
Community Expert
Community Expert
November 19, 2022
SteNe99
SteNe99Author
Participant
November 21, 2022

Thank you for the advice! 

Unfortunately, it's not really the same problem.
The suggested solutions are about getting a connection to the WebSocket via SSL in the first place.

That works for me.

My problem, however, is that it doesn't always work. The more users want to establish a WebSocket connection, the more likely it is that you will get a timeout.

BKBK
Community Expert
Community Expert
November 21, 2022

Thanks for clarifying, @SteNe99 . I realize only now that a user may connect successfully one moment, then fail to connect later. That can be frustrating, I would imagine.

 

Question:

What is the update level of your ColdFusion 2018 installation? I ask because there was an update of the websockets library in ColdFusion 2018 Update 11

 

Suggestion:

Since you use a firewall, I would suggest that you make use of a websocket proxy. For deatils on how to do so, see "Websocket Enhancements".

Community Expert
November 18, 2022

This is kind of a shot in the dark, but do you have any third-party firewall or network security software installed? This doesn't sound like a CF problem.

 

Dave Watts, Eidolon LLC

Dave Watts, Eidolon LLC
SteNe99
SteNe99Author
Participant
November 21, 2022

We use Windows Defender Firewall and have opened ports 8579 (WebSocket) and 8543 (SSL).

When I call our web application very early in the morning, the connection to the WebSocket works without problems.
I do this via Javascript: new WebSocket("wss://subdomain.domain.top-level:8543/cfusion/cfusion");

But as soon as multiple users call the web application, it happens that user A can connect and user B gets a timeout.