Lucee Websockets Extension

I was having similar thoughts before I wrote the extension :wink:

Thanks for the quick reply.

I’ve never used NGinx, but we use IIS which I would hope/imagine doesn’t have any limits on Windows ( we also run exclusively Windows Server 2012 R2 at the moment ). Would you think that’d be the case?

Maybe when I get around to it I’ll run some load tests and see what it can handle, I have a CF => Node/Socket.io thing running on a production site that averages 100-200 active users at any moment and seems to use almost 0% CPU and < 70MB of RAM, so other than the whole making http requests from CF to Node on the same server it seems like a viable option. Something about those cfhttp calls though just make me feel uncomfortable :slight_smile:, hoping to switch to your extension for future use.

Thanks again,
David

I expect no such issue with IIS since it’s native to Windows.

It’d be great if you can post somewhere your WebSocket proxy settings for IIS for future users. Some users asked in the past and I don’t think that they got any useful replies in our forums.

As far as I know we’re not using any proxying. I have Node listening on port 8443, which Socket.io connects to, and then just cfhttp post to it over that port.

Ah, didn’t sleep much last night. In this moment I’m realizing IIS won’t be a part of this at all. It’s just people’s browser connecting directly to the Node app, which is also its own web server :slight_smile:

Haven’t touched that code in a while, forgot how it worked until I just looked at it.

Exactly. If you set it up with nginx that same way then there’s no issue there either, since the web server is not part of that system anyway.

Until you get to 512 concurrent connections right?

Yes, of course.

WebSocket connections remain open for as long as the websocket session is alive, so as long as the clients are connected at the same time they are all concurrent. That is very different from HTTP where the connection is opened and closed for the request.

But if you’re not using nginx on Windows then that’s not a factor.

isapir, I’m wondering if you have any resources available for a very simple, very basic simple example of connecting to a socket.io endpoint and displaying that data on a CFML page. No need to serve socket data to anybody, no need to communicate packets back and forth. Just a very, extremely basic simple uncomplicated brief simple example of connecting to a socket.io endpoint and then displaying that data on the page.

I’m trying to understand your tutorials but they all seem to be focused on serving data out from the server and doing chat-like things, rather than just simply connecting to a endpoint and displaying that data.

Is that possible with this extension?

Thanks!

The extension currently only implements the server side, so that is not possible.

IIUC you want to connect from Lucee to a node.js server, so the Lucee end will act as a WebSocket client, which is not implemented at this time.

I was planning to add that functionality, but… life happens.

There is actually a websocket client in the beta extension provider that allows you to connect to websocket servers. Download Lucee

Awesome, I will give it a shot. Is there any documentation for this extension that I could reference to help get me started? Thank you!

Not that I am aware of

You might try the project itself:

The project documentation WIKI:

And these tutorial videos…

Getting Started

Example Chat

Hi Modius,

I was actually looking for documentation for the beta websockets client version, referenced in Yamaha32088’s comment here.

Whoops. Sorry about that :slight_smile: not as much documentation on that side of the equation.

Any way to receive binary messages? Perhaps using the underlying Java connection object?
How about sending ping messages?

Hello @isapir !
We used Lucee and you Websocket extension with IIS on Windows R2 test environment.
To run this on iis i used this https://lucee.daemonite.io/t/troubleshooting-lucee-websockets-with-iis-and-arr/2687 , so i created proxy to rewrite call to localhost:8888 to use websockets, looks like works correctly.
So the question:In the future we should have possibility to open 10 000 at one time, does it looks possible and does lucee has some limitation for one time sockets count?
Thanks in advance

1 Like

The only limitation should be your hardware, not Lucee.

1 Like

@Vitaly_Rachitskiy - like @Terry_Whitney said, it should work if the rest of your Staten can handle it.

One thing I’ve noticed in nginx, on the Windows edition only, there is a connection limit of 1,024 connections. Since each WebSocket uses two connections, one to the client and one to Lucee, it doesn’t scale well, and you reach a maximum at around 500 client connections.

With IIS on Windows you don’t have that issue, not would you have it with nginx on Linux.

Thanks isapir for your work on this extension. Experimenting with v2.0.1 and following the chat example. On the client side we’re concerned about invoking several WebSocket objects with different end points for the various channels, like:

var wsl = new WebSocket(“wss://someplace.com/ws/sports/live”);
var wsd = new WebSocket(“wss://someplace.com/ws/sports/delayed”);
var wel = new WebSocket(“wss://someplace.com/ws/entertainment/live”);
var wed = new WebSocket(“wss://someplace.com/ws/entertainment/delayed”);
var wfl = new WebSocket(“wss://someplace.com/ws/finance/live”);
var wfd = new WebSocket(“wss://someplace.com/ws/finance/delayed”);

I see that you can establish and subscribe to channels on the server side using the ChannelManager, but it looks the client will still be creating 6 WebSocket objects. Are there limits on the number Javascript websockets?

Thanks for any insight on this.