5 Replies Latest reply on Sep 18, 2015 2:52 AM by BKBK

    websockets in CF11

    Rick W

      Hello, I have been trying to get websockets working in our CF 11 update 6/IIS8 server to no success.  I would love to use SSL, but as part of my testing I have even tried non-ssl with no luck. The instructions I have followed are these, Using WebSocket with ColdFusion 11 | Adobe Developer Connection.


      Using Chrome I see that I receive this for standard proxy configuration on a non-SSL connection, "Error during WebSocket handshake: Unexpected response code: 200." This does show as a ws connection.


      If I configure the builtin server and use SSL the error is WebSocket connection to 'wss://name.of.server:8543/cfusion/cfusion' failed: Error in connection establishment: net::ERR_TIMED_OUT."  The name of server is correct just removed here since I've been testing at times without firewall to eliminate that problem. I don't get where the cfusion/cfusion is derived from however. I am not sure why it isn't using cfws there that the non-ssl ones do. Port 8543 is open (even when the firewall is on).


      If I set secure = false and redo the builtin server without SSL, I get "failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT" and it is for ws.


      I have seen a different page discuss changes needing made to server.xml. When I try them, I cannot get CF to restart.


      IIS has websockets on, and I see the cfws directory in the IIS manager.


      Thanks for any ideas as to what I might be missing.

        • 1. Re: websockets in CF11
          nic_tunney Adobe Community Professional

          Did you name any websocket channels in your Application.cfc?  Like this:

          this.wschannels = [{name="stocks"},{name="chat"}];

          • 2. Re: websockets in CF11
            Rick W Level 1

            Thank you for the reply, the code we have has this in it:



              <cfset this.name = "Cf11Examples">


              <cfset this.wschannels = [{name="chat"}]>



            • 3. Re: websockets in CF11
              nic_tunney Adobe Community Professional

              That does your cfwebsocket call look like?  Are you then using JS after defining the endpoint in cfwebsocket?  If so can you also include that code?

              • 4. Re: websockets in CF11
                Rick W Level 1

                Thanks for helping look. Our programmer said all this was plagerized, we are just wanting something working before we start customization. I have tried setting security to false and changing CF Admin to not use SSL just to see if the problem is with our cert, but that hasn't helped. I grabbed the programs, here is application.cfc:



                  <cfset this.name = "Cf11Examples">

                  <cfset this.wschannels = [{name="chat"}]>



                And here is the index.cfm:


                <cfwebsocket name="webSocketObj"






                             secure="true" />


                             <doctype html>


                <title>WebSocket Example</title>

                   <script type="text/javascript">

                             messageHandler =  function(aEvent,aToken) {

                                    if (aEvent.data) {

                           var txt=document.getElementById("msgArea");

                           txt.innerHTML += aEvent.data  +"<br />";



                            openHandler = function() {

                            alert("Connection is open");


                            closeHandler= function() {

                            alert("Connection Closed");



                              errorHandler = function() {




                                 sendMessage = function() {

                            var text = window.prompt("Enter some text","");

                            if (text) {

                                webSocketObj.publish("chat", text);






                    <div id="msgArea" />

                    <input type="button" value="Send Message" onClick="sendMessage()">




                Thanks again.

                • 5. Re: websockets in CF11
                  BKBK Adobe Community Professional & MVP

                  I got your code to work as expected. I copied your exact code to my ColdFusion 11 set-up, with two exceptions.


                  1) I changed the secure attribute to false.


                  2) I added form tags. In other words, I replaced the input tag with


                  <input type="button" value="Send Message" onClick="sendMessage()">



                  I left the websocket settings in the Coldfusion Administrator at their default values, as follows: