Websockets in Lucee


Has anyone been able to get websockets to work in Lucee? I have an upcoming
project here that I need to start on later this week that would be perfect
use case for them but I don’t see them supported yet.




I have been meaning to check this out


There is also this

Mark Drew


If you need a web socket client, I wrote one in Java:

I just added some basic implementation instructions that explain how to instantiate it and send messages.



I’m the one who wrote the one that AJ mentioned below. I have four
projects in production using it under Lucee 4.5. One of them has appx
2,000 connected clients on a single instance at any given moment. The only
bump I’ve ever run into is when you deploy it to Amazon, you need to watch
for their load balancer, since it doesn’t support WebSockets.

I haven’t tried it on Lucee 5.x yet. I’m sure there will need to be some
work done to it to make it OSGi compatible.



This is the library that I tried to get working with just a express version
of Lucee and as soon as I added in the listener entry to the web.xml it
wouldn’t start. I will give it another shot later on tonight.

John Blayter


If you want to use web sockets with AWS ELB, make sure to use TCP instead
of http/https. By using TCP, you can use web sockets, but if you use SSL, you need to
process that on the server level, not the ELB.

Hope that helps.
Michael van Leest


By the way, this only works if you open a websocket on a different port,
instead of using the existing servlet (like my engine does). The AWS EBL
does not understand the UPGRADE HTTP directive and ends up blocking it.



Nicholas - I’m giving your project a spin, however - in your git readme it
says “Copy the wsRailoEndpoint.jar” - well, that’s not in the repo.

I compiled it, but others may not know how to. Just thought you should know.



It’s actually located on the Releases tab on the GitHub repo. I need to
update the docs a bit since GitHub lays things out a bit different than
Google Code.



Need more info. What is returning the failed status? Lucee? The web socket client?

What have you checked so far? Lucee config? Lucee log files?

Help us help you! :wink:

Kind regards,
Jordan Michaels


I am trying to get this working on Lucee 4.5 but when I create my websocket
driver event gateway it returns a status of “failed”. Everything looks to
be in the correct place.


Actually never mind. After further investigation I realized that my client
was failing to connect because the version of apache I have on local is 2.2
which does not proxy ws:// out of the box (It needs a 2.4 module recompiled
for it to work). I just changed my client to go directly to railos port
number and everything worked.


Nicholas -

I’m trying to get your WS implementation running under Lucee 4.5.
I can set up a new Event Gateway in the admin, and it also says “running”,
but I can’t hit ws://{server}/wsEndpoint/{channel} (tried the HTML5 client
at websocket.org). The log file referenced in WebsocketWatcherListener.cfc
is not created, so my guess is the CFC is not invoked at all.
Any pointers where to investigate further?




It looks like I finally have everything set up properly under Lucee, and
the “railoWebSocketServer” is running (per Event Gateway admin).
But I’m getting a 404 when I try to connect to it in my HTML5 app.

The WebSocketListner.log shows that the channel is being initialized:

"Initilizing WebSocket interceptor for channel [testing]"

Should there be another log item for when/if initialization is successful,
or is that the only line I should be getting?

gateway.log shows


exception.log gives a full trace, but it looks like it’s bombing on

<cfset variables.wsJavaDriver.watchChannel(config.channel)>

in /lucee/components/lucee/extension/gateway/WebsocketWatcher.cfc

Any ideas?


What is the full stack trace where its failing?


What is the full stack trace where its failing?

at java.net.URLClassLoader$1.run(URLClassLoader.java:366):366
at java.net.URLClassLoader$1.run(URLClassLoader.java:355):355
at java.security.AccessController.doPrivileged(Native Method):-2
at java.net.URLClassLoader.findClass(URLClassLoader.java:354):354
at java.lang.ClassLoader.loadClass(ClassLoader.java:425):425
at java.lang.ClassLoader.loadClass(ClassLoader.java:358):358
at java.lang.Class.getDeclaredMethods0(Native Method):-2
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625):2625
at java.lang.Class.privateGetPublicMethods(Class.java:2743):2743
at java.lang.Class.getMethods(Class.java:1480):1480
at lucee.runtime.java.JavaObject.call(JavaObject.java:234):234
at lucee.runtime.java.JavaObject.call(JavaObject.java:259):259
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1593):1593
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:608):608
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
at lucee.runtime.ComponentPage.callWDDX(ComponentPage.java:670):670
at lucee.runtime.ComponentPage.call(ComponentPage.java:202):202
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:954):954
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:906):906
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2265):2265
at lucee.runtime.gateway.CFCGateway.callOneWay(CFCGateway.java:169):169
at lucee.runtime.gateway.CFCGateway.doStart(CFCGateway.java:99):99
at lucee.runtime.gateway.GatewayThread.run(GatewayThread.java:41):41

Line 42 in the installed version of WebsocketWatcher.cfc is the line I
mentioned above

<cfset variables.wsJavaDriver.watchChannel(config.channel)>


It’s working now… added this 2 lines on my httpd config

ProxyPass / ws://
ProxyPassReverse / ws://

And for the failed status, I changed few paths on WebsocketWatcher.cfc


I try to install the version of Nicholas. I got a failed status on the
Admin: Services - Event Gateway page.

The only thing I’m not sure is that I have not seen any web.xml like in the
railo server. I have created one at the same place and put the listener

Thank you,


Hi Jordan,
I had a comparable problem. I have configured the Lucee V4.5.2.018 server
to work with WebSockets. I have configured 6 Event Gateways on different
ports. The WebSockets work fine!? …but in the Lucee server admin all
Gateways are marked as State “failed”.

The only information I got is after the server/Tomcat V8 startup in the

Here it states

Gateway [restwert_viewuser] initialized"
Gateway [insurerw_cardata] initialized"
"INFO","Thread-11","08/10/2016","14:10:49","","Starting websocket server on 
port 10128"
Gateway [restinza_cardata] initialized"
"INFO","Thread-12","08/10/2016","14:10:49","","Starting websocket server on 
port 10127"
Gateway [restwert_cardata] initialized"
"INFO","Thread-13","08/10/2016","14:10:49","","Starting websocket server on 
port 10126"
Gateway [insurerw_viewuser] initialized"
"INFO","Thread-14","08/10/2016","14:10:49","","Starting websocket server on 
port 10125"
"INFO","Thread-15","08/10/2016","14:10:49","","Starting websocket server on 
port 10130"
Gateway [restinza_viewuser] initialized"
"INFO","Thread-16","08/10/2016","14:10:49","","Starting websocket server on 
port 10129"
"INFO","Thread-11","08/10/2016","14:10:49","","Started websocket server on 
port 10128"
"INFO","Thread-16","08/10/2016","14:10:49","","Started websocket server on 
port 10129"
"INFO","Thread-14","08/10/2016","14:10:49","","Started websocket server on 
port 10125"
"INFO","Thread-13","08/10/2016","14:10:49","","Started websocket server on 
port 10126"
"INFO","Thread-12","08/10/2016","14:10:49","","Started websocket server on 
port 10127"
"INFO","Thread-15","08/10/2016","14:10:49","","Started websocket server on 
port 10130"

…which lookes successful! …and it works!?

Why is the state at the server marked as “failed”?

Best regards