Websockets in Lucee

What is the full stack trace where its failing?

What is the full stack trace where its failing?

"ERROR","Thread-13318","04/22/2016","15:12:13","",";javax/websocket/Session;javax/websocket/Session
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.reflection.storage.SoftMethodStorage.store(SoftMethodStorage.java:66):66
at 
lucee.runtime.reflection.storage.SoftMethodStorage.getMethods(SoftMethodStorage.java:49):49
at 
lucee.runtime.reflection.Reflector.getMethodInstanceEL(Reflector.java:491):491
at 
lucee.runtime.reflection.Reflector.getMethodInstance(Reflector.java:680):680
at lucee.runtime.java.JavaObject.call(JavaObject.java:234):234
at lucee.runtime.java.JavaObject.call(JavaObject.java:259):259
at 
lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:743):743
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1593):1593
at 
lucee.extension.gateway.websocketwatcher_cfc$cf.udfCall(xxxxxxxxxxxxxx/WEB-INF/lucee/components/lucee/extension/gateway/WebsocketWatcher.cfc:42):42
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.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
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.listener.ModernAppListener._onRequest(ModernAppListener.java:225):225
at 
lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:37):37
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2265):2265
at 
lucee.runtime.gateway.GatewayEngineImpl.call(GatewayEngineImpl.java:358):358
at 
lucee.runtime.gateway.GatewayEngineImpl.callOneWay(GatewayEngineImpl.java:329):329
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://127.0.0.1:8888/
ProxyPassReverse / ws://127.0.0.1:8888/

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
code.

Thank you,
Julien

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
Lucee/logs/websocket.log

Here it states

"INFO","localhost-startStop-1","08/10/2016","14:10:49","","WebSocket 
Gateway [restwert_viewuser] initialized"
"INFO","localhost-startStop-1","08/10/2016","14:10:49","","WebSocket 
Gateway [insurerw_cardata] initialized"
"INFO","Thread-11","08/10/2016","14:10:49","","Starting websocket server on 
port 10128"
"INFO","localhost-startStop-1","08/10/2016","14:10:49","","WebSocket 
Gateway [restinza_cardata] initialized"
"INFO","Thread-12","08/10/2016","14:10:49","","Starting websocket server on 
port 10127"
"INFO","localhost-startStop-1","08/10/2016","14:10:49","","WebSocket 
Gateway [restwert_cardata] initialized"
"INFO","Thread-13","08/10/2016","14:10:49","","Starting websocket server on 
port 10126"
"INFO","localhost-startStop-1","08/10/2016","14:10:49","","WebSocket 
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"
"INFO","localhost-startStop-1","08/10/2016","14:10:49","","WebSocket 
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
Heinz

If you want to submit a pull request of those changes to make it compatible
with Lucee, that would be great. I can get a clean build out for everybody.

-Nick

What’s the most recent update on this issue? Are there any recent
developments on this issue? I need to implement websockets on Lucee,
ideally in a distributed environment, but I’ll take a single-server
implementation to start with. I ran into this repo, but I couldn’t figure
out how to implement a receive message callback:

Maybe raise a ticket in that GitHub repository?

Mark Drew

I use web sockets from Lucee to send updates from LogBox to a NodeJS relay
using a WebSocketAppender.

FYI, I created an enhancement request in the Lucee issue tracker for this:

https://luceeserver.atlassian.net/browse/LDEV-1008

Please vote for it!

Is there any production-ready solution to get websockets running on Lucee 5?

Yes, we are using websockets in our CMS and custom projects with Lucee.

We built a custom Java Websockets library – if you are interested, just contact me and I can get you in touch with our developers.

Works very well with many parallel threads, we spent a lot of time on load tests with JMeter.

-Harry

I just published the Lucee WebSocket Extension as a BETA release.

Please watch for details. I am a bit short on time ATM, so so I made this video in 1-take (no time
for editing).

Links are in the video description.

I will try to add more information when I have more time.

HTH,

Igal Sapir
Lucee Core Developer

1 Like

Good video

Great job Igal, thank you for putting this together!

FYI, I spent quite a bit of time with the extension that @Igal wrote. It’s
definitely worth a look, but be aware that it’s not as simple as enabling
the extension. To get a robust websocket solution, you would need to write
some sort of module that takes advantage of the low-level access to
websockets that become available through the extension. Also, the extension
is experimental at this point, and it doesn’t work with any stable
releases, afaik.

I was able to built what I think is a fairly complete wrapper for the
extension that allows your app to manage multiple endpoints and connections
within each endpoint. I would be happy to share my code with anyone who is
interested.

1 Like

JP, can you put your work on ForgeBox so anyone else can grab it and
install?

https://ortus.gitbooks.io/commandbox-documentation/content/packages/forgebox/publishing_packages.html

~Brad

A post was split to a new topic: Lucee Websockets Extension

Hi JP1

I would be very interested, but I am having problems just trying to install the websockets extension:


Hi Igal

I am using Lucee 4.5.3.018

I have downloaded the extension via the link you provided with your YouTube video.
When I try and upload in Lucee Server Admin → Extensions → Applications, using the browse field, I get an error, saying that only ‘zip’ files can be uploaded.

I also see there is now an extension called ‘Server Socket’ which is not in beta.
Is this extension the same thing? If so, I could install it normally, presumably.
But, it does not look the same???

Also the link you provided for the sample application, does not work. My browser just times out.

Thanks for any help you can provide me!


This was a message I wrote to Igal, but have yet received no response. Maybe, you could help me with these issues, if you have successfully installed the extension?

Please e-mail me if this easier for you: cdesign@btinternet.com

Thanks

Charlie

Charlie,

I don’t think I’ve seen that message?

The extension can now be installed via the admin, but it requires a newer version of Lucee. Please see minimum requirements at GitHub - isapir/lucee-websocket: Enables server WebSockets for Lucee via JSR-356 compliant servlet containers (e.g. Tomcat 8, Jetty 9.1, etc.)