Guest
Guest

Reputation: 381

Coldfusion Websocket Channel Listeners

I'm playing around with the Coldfusion Websockets and have been trying to follow this tutorial. However, I can't seem to get the channel listener part working for: "HelloWorld – Version 2: Using a channel listener".

I have the code in the application correct, but I think it can't find the cfclistener.

this.wschannels = [ {name="world", cfclistener="myChannelListener" }];

I have the cfc made with the beforePublish to append the time but it's not working. I'm using CFWheels and just put the channel listener cfc in the controllers folder. I tried the above code with different variations such as:

.. even trying the path from the C drive:

but they all do not work. I'm pretty sure it's a path problem. Does anyone know how to specify the cfclistener path?

Upvotes: 0

Views: 811

Answers (3)

developer snail
developer snail

Reputation: 11

Although I'm not using CFWHEELS, I had issues as well getting the second example to work as well. The last two changes I made before it worked:

  1. Opened CF administrator. services > web sockets (checked "Enable WebSocket Service", checked "use built in websocket server")
  2. Restarted CF using cfstart.bat (located in CF_install_directory/cfusion/bin)

At the very least I can confirm that the example provided in the article works with some fiddling.

Upvotes: 1

Dave Ferguson
Dave Ferguson

Reputation: 773

The event handler does not use your sites application.cfc file. Thus your cfwheels application is not even coming into play. The handler, cfclistener, path should be dot a dot notated path from the application root.

See:

https://learn.adobe.com/wiki/display/coldfusionen/Using+WebSocket+to+broadcast+messages

Scroll down to "Using channel listener functions"

Upvotes: 0

Chris Peters
Chris Peters

Reputation: 18090

This is most likely due to the fact that CFWheels URL rewriting does not allow you to bind directly to a CFC.

Try putting the CFC in the miscellaneous folder and see if it works from there. If so, you can either keep it there or create a subfolder of your choosing and make sure to exclude it from URL rewriting.

Note that if this works and is the route that you take, you will be completely outside of the CFWheels framework within your myChannelListener CFC.

Upvotes: 0

Related Questions