Port 8888 not working (websockets)


I’m giving websockets another try and I want to have it working on my localhost Lucee I’m following this github:link

What have I done:
I installed it in the web environment through extensions version 2.0.3. Added the servlet jar file. Added the url pattern in the web.xml. Made a simple example following the video on the page.

What is the error
When I call the example page then I see the page but get the following error:

index.cfm:15 WebSocket connection to ‘ws://localhost:8888/ws/echo’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Where I think the problem lies
I go to this page using this url “localhost/chattest/index.cfm”. But in the example he goes to “localhost:8888/etc.”. When I go to “localhost:8888” I get the following error:


So I think somethings wrong with the port 8888. I tried to find out if there are other applications using this port, but it seems not to be the case. Is it something I have to do in Tomcat? Can’t find many answers online. I’ve also have a websocket.log file, but nothing showing up there.

If somebody could help me point me in the right direction then that would be very helpful

Thanks in advance,

1 Like

Can you try replacing localhost with “” in your code?

Also, keep in mind localhost/chattest/index.cfm is NOT the same as localhost:8888/chattest/index.cfm (first is port 80, second is port 8888) and that’s probably why you’re getting the “Deze site is niet bereikbaar” message. Sounds like using localhost/chattest/index.cfm (or is what you should be doing, and using port 8888 to connect to ws in your code (something like ws://, i think).

If you can provide us your code and web.xml file, we can help debug more.


Thanks for your response. I also tried “” but every combination gives the same error. I think it has something to do with the fact I cant get working. Here is the code to the index page:
https://codeshare.io/UbKVU and here is the code to the xml: https://codeshare.io/5ZMnZz. The listener is as followed:

component {
function onMessage(websocket, message, sessionScope, applicationScope){
return “Echo from Lucee #Server.lucee.version# [#arguments.message#]”;

And if I do as you said then I get the ERR_CONNECTION_REFUSED error. Sound more like a general error that something is blocked.


I dont see where you are specifying that the websocket should run over port 8888. From your code, it appears that it would be running under port 80. Try :80 instead of :8888

Yea my question is where is the setting for this port and how can I get 8888 working? I tried the port 80 but then you get a 404. And with port 8888 i get the next error connection refused. But if you look at the example in the websocket github then you see he uses port 8888. I think this is the port the websocket can use, if correctly installed.

I think he is using :8888 because that’s the port on which his Lucee is running. Do you have Apache or NGinx running in front of Lucee? What port is your Lucee running on?

What is the exact error message you receive (check console.log). Try the following command in console with various ports:

var wsecho = new WebSocket(“ws://localhost:8080/ws/echo”);

If you get: VM524:1 WebSocket connection to ‘ws://localhost:8080/ws/echo’ failed: Error during WebSocket handshake: Unexpected response code: 404, then that means your WS didn’t register properly or your files are not in the correct location.

If you get: VM530:1 WebSocket connection to ‘ws://localhost/ws/echo’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED, then it’s probably the wrong port.

Well Lucee itself runs on port 80. This is the only port that works when I try to open the page in the browser. I’ve put it all in one screenshot:

edit: also tried with again


So for you, port 80 is the correct port.
I installed per the README file at https://github.com/isapir/lucee-websocket
I put servlet-filter-utils-1.1.1.jar in tomcat lib directory
I added required snippet to the web.xml file in tomcat/webapps/lucee-
Restarted tomcat and the EchoListener example works for my Lucee port 8080

Hmm the only difference is that my web is located at “‪C:\lucee\tomcat\conf\web.xml”? I don’t have a web.xml in my web-inf folder.

You removed the :8888 from your index.cfm file?

Jup, weird it doesn’t work. But thanks for the info, I will try next week some more stuff.

I didn’t do anything with websocket yet, but from looking into your web.xml (shared on codeshare) and Igals instructions: I am missing the filter section in your web.xml.

I want to try websockets also, it is on my todos list. Going to post back then.


It’s all the way on the bottom. First I placed it near the filter section, but I tried to change things up to check if it works.

I recently implemented WebSockets on an Ubuntu Apache web-server having WebMin and configured with http-2 and here are my notes:

STEPS FOR WEBSOCKETS: install the lucee websocket plugin /lucee/admin/server.cfm?action=ext.applications … then download the file servlet-filter-utils-1.1.1.jar from https://github.com/isapir/lucee-websocket/releases and put it in the {tomcat}/lib directory of the lucee install … next you need to activate the ws:// and wss:// protocols in apache: sudo a2enmod proxy_wstunnel … then add to the {tomcat}/conf/web.xml file:

<!-- Required for the Lucee WebSocket Extension !-->    

  <!-- modify url-pattern to match your websocket endpoints !-->

… next add to the apache2 global config Webmin > Servers > Apache Webserver > Global configuration > Edit Config Files :

**ref Only**:<IfModule mod_proxy.c>
**ref Only**:ProxyPreserveHost On
**add this**:ProxyPassMatch ^/ws/(.*)$ ws://$1
**Other Stuff Here ... **
**ref Only**:ProxyPassReverse /
**ref Only**:</IfModule>

Finally add websocks to the log settings: /lucee/admin/server.cfm?action=server.logging {ame:“websocket”,appender:“Resource”,layout:“classic”,level:“debug”}

1 Like

So I’ve played a little with this extension, and everything seems to go pretty well just as described in Igal Sapirs instructions.

What I understand from your post is that in your configuration you can access Lucee on port 80, but not on port 8888? That means that, or you have:

  • a webserver (like Apache or IIS)) in front of Lucee and Lucee is not running on its default port:8888, or
  • Lucee is running as stand alone on port:80

To identify that, please look for the port Lucee/Tomcat is running on, by opening your server.xml at {installation path}\lucee\conf\server.xml and search for connector port". If its 8888 then you should be able to access http://localhost:8888 without any problem, unless something else is conflicting (e.g. firewall, another webserver or service running on port 8888, or hardcoded hosts-file entry for localhost pointing to another IP).

Here I am posting my step by step instructions of what I’ve done:

My System:
OS: Win10
Java: Zulu (build 1.8.0_202-b05)
  1. Downloaded the latest stable Express Version
  2. Started Lucee and logged into server-admin at: http://localhost:8888/lucee/admin/server.cfm
  3. From that server-admin-page at Extensions => Applications I installed Igals websocket extension 2.0.3
  4. Downloaded servlet-filter-utils-1.1.1.jar from
    https://github.com/isapir/lucee-websocket/releases/download/2.0.2/servlet-filter-utils-1.1.1.jar to the folder *{installation path}\lucee\lib\ext*
  5. Stopped Lucee
  6. Deleted all the files/folders inside the webroot:
    {installation path}\lucee\webapps\ROOT\
  7. Added the following code just before the <welcome-file-list> tag at the bottom of {installation path}\lucee\conf\web.xml:
 <!-- Required for the Lucee WebSocket Extension !-->    

      <!-- modify url-pattern to match your websocket endpoints !-->
  1. Created the three files:
    {installation path}\lucee\webapps\ROOT\ChatListener.cfc
    {installation path}\lucee\webapps\ROOT\Application.cfc
    just as posted from the wikis chat-example at:
    For {installation path}\lucee\webapps\ROOT\index.cfm try this slightly modified code:
<!--- index.cfm --->
    /** ensure that we have Session.username and set a default channel */

    if (!isNull(URL.username))
        Session.username = URL.username;

    if (isEmpty(Session.username ?: "")){

        echo("<p>Session.username is not defined. Set it using the URL parameter username, e.g. ?username=Lucy");

    param name="channel" default="default";

    <!--- JavaScript follows !--->
        function sendText(){
            var texttosend=document.getElementById("texttosend").value;

        var channel  = "#channel#";
        var endpoint = "/ws/chat/" + channel;
        var protocol = (document.location.protocol == "https:") ? "wss://" : "ws://";

        var wschat   = new WebSocket(protocol + document.location.host + endpoint);

        var log = function(evt){
            console.log(evt.data ? JSON.parse(evt.data) : evt);
        var writemessage=function(evt){
            console.log(evt.data ? JSON.parse(evt.data) : evt);
                document.getElementById("chatcontent").insertAdjacentHTML("afterbegin", res.FROM+': <b>'+ res.MESSAGE+'</b> <i>at '+res.TIMESTAMP+'</i></br>');
        wschat.onopen    = log;
        wschat.onmessage = writemessage;
        wschat.onerror   = log;
        wschat.onclose   = log;

        document.title   = `#Session.username# on ${channel}`;
        document.write(`<p>[wschat] connected to "${channel}" as "#Session.username#"`);
<style type="text/css">#inputfield{position:fixed;bottom: 0; left:0;padding:30px;} #texttosend{width:100%;}</style>
    <div id="chatcontent"></div>
    <div id="inputfield">
        <input type="text" id="texttosend">
        <button onClick="sendText();">Send</button>

  1. Started Lucee
  2. Opened in Chrome: http://localhost:8888/?username=User1 and opened its WebDevTool by pressing F12 (with the console-view)
  3. Opened in Firefox http://localhost:8888/?username=User2 and opened its WebDevTool by pressing F12 (with the console-view)
  4. Entered in Chromes WebDevTool Console console>wschat.send('This is a test');
  5. Confirmed the receipt of the message within the Console of Firefox

Igals websocket works as espected. Important to know is that this chat example is not a 100% finished chat. It just sends messages and receives JSON data and logs it to the respective consoles. It’s up to you to create a front end with that.

Hope that helps a little.


Thank you for this extended answer! That probably a big help for many.
I’m a bit busy this week, but I hope to continue playing with this in the weekend.

I made a whole front-end/back-end couple of years ago, but we’ve never got to use it because
the websocket weren’t reliable. On random moments the messages weren’t coming through.

So I wanted to do a clean setup to check if I can get it working again. I will follow your answer step-by-step and come with a response. But thanks in advance!

Hey again,

I couldn’t help myself, so I took a quick look:

So like I said in my previous posts that I think the problem is that I cannot access port 8888.
You said to look for the port in the server.xml. I found it and it was on 80, changed that to 8888.
And now it’s working… so thanks!

Now I will look if I can enable this is our bigger projects.

1 Like

Great news!!!