Highlighted

Channel Doesn't Exist or is not running

New Here ,
Mar 11, 2015

Copy link to clipboard

Copied

I am using CF 11, IIS 7.5 and windows 7 pro. when I create a sample application using websockets I get the following results:

{"msg":"ok","code":0,"clientid":40495741,"ns":"coldfusion.websocket.channels","reqType":"welcome","type":"response"}

{"msg":"Channel 'stocks' doesn't exist or is not running.","code":-1,"clientid":40495741,"ns":"coldfusion.websocket.channels","reqType":"subscribe","type":"response"}

can someone help me understand why I am getting the second error message.

Thanks

Views

1.0K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Channel Doesn't Exist or is not running

New Here ,
Mar 11, 2015

Copy link to clipboard

Copied

I am using CF 11, IIS 7.5 and windows 7 pro. when I create a sample application using websockets I get the following results:

{"msg":"ok","code":0,"clientid":40495741,"ns":"coldfusion.websocket.channels","reqType":"welcome","type":"response"}

{"msg":"Channel 'stocks' doesn't exist or is not running.","code":-1,"clientid":40495741,"ns":"coldfusion.websocket.channels","reqType":"subscribe","type":"response"}

can someone help me understand why I am getting the second error message.

Thanks

Views

1.0K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 11, 2015 0
Advocate ,
Mar 12, 2015

Copy link to clipboard

Copied

The channel is what the socket connection is trying to connect to. You usually define them in the Application.cfc. It looks something like this:

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

You are getting the error because the channel "stocks" is not listed here. Based on your previous forum post I imagine you have adapted a sample from somewhere but have not changed all the bits completely.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 12, 2015 0
New Here ,
Mar 13, 2015

Copy link to clipboard

Copied

thx haxtbh,

I have this in my application.cfc

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

and this is in my index.cfm

<script>

   //messagehandler recieves all the messages from websocket

   function mycbHandler( messageobj)

   {

   var message = ColdFusion.JSON.encode(messageobj);

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

  txt.innerHTML +=message  +"<br>";

   }

 

   //openhandler is invoked when socket connection is

   function openHandler()

   {

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

  txt.innerHTML +="open Handler invoked <br>";

   }

 

   function subscribeMe()

   {

   var channelname = document.getElementById("channelname").value;

  mywsobj.subscribe(channelname);

   }

   function getSubscribers()

   {

   var channelname = document.getElementById("channelname").value;

 

   }

   function unsubscribe_Me()

   {

   var channelname = document.getElementById("channelname").value;

  mywsobj.unsubscribe(channelname);

   }

   function publishClient()

   {

   var channelname = document.getElementById("channelname").value;

   var message =  document.getElementById("msg").value;

  mywsobj.publish(channelname,message);

   }

   function get_Subscriptions()

   {

 

   }

   function invokenpublish()

   {

  cfcname = document.getElementById("cfcname").value;

  fnname = document.getElementById("fnname").value;

  channelname = document.getElementById("channelname").value;

  mywsobj.invokeAndPublish(channelname, cfcname, fnname)

   }

   function invokefn()

   {

  cfcname = document.getElementById("cfcname").value;

  fnname = document.getElementById("fnname").value;

  channelname = document.getElementById("channelname").value;

  mywsobj.invoke(cfcname, fnname)

   }

   function opensocket()

   {

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

  txt.innerHTML+="opening socket"+"<br >";

  x=mywsobj.openConnection();

   }

   function stopsocket()

   {

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

  txt.innerHTML+="closing socket"+"<br >";

  x=mywsobj.closeConnection();

   }

   function checksocket()

   {

   var x=mywsobj.isConnectionOpen();

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

  txt.innerHTML+=x+"<br >";

   }

</script>

<form name="f">

 

<cfwebsocket name="mywsobj" onMessage="mycbHandler" onOpen="openHandler"/>

<br> Subscribe to:

<input  id="channelname" name="channelname" type="text" value="stocks" >

<input  id="stocksSubscribe" type="button" value="stocksSubscribe" onclick="subscribeMe();">

<input  id="unsubscribeMe" type="button" value="unsubscribeMe" onclick="unsubscribe_Me();">

<input  id="getSubscribersCF" type="button" value="getSubscribersCF" onclick="getSubscribers();">

<input  id="getSubscriptions" type="button" value="getSubscriptions" onclick="get_Subscriptions();">

<br>

Message :<input id="msg" type="text" >

<input  id="publishMe" type="button" value="publishMe" onclick="publishClient();">

<br>

CFC Name: <input  id="cfcname" name="cfcname" type="text" value="invokeandpublish" >

Function Name: <input  id="fnname" name="fnname" type="text" value="publishall" >

<input  id="invoke_publish" type="button" value="invoke_publish" onclick="invokenpublish();">

<input  id="invoke" type="button" value="invoke" onclick="invokefn();">

<br>

<input  id="stop" name ="Close" type="button" value ="stop" onclick="stopsocket()" >

<input  id="open" name ="Open" type="button" value ="open" onclick="opensocket()" >

<input  id="check" name ="Check" type="button" value="check" onclick="checksocket()" >

<br>

<div id="myDiv"></div>

yes this is something I copied for a sample that I am trying to get it to work so I can understand how this works.

thanks for your help.

if I am missing something please let me know.

thanks,

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 13, 2015 0
Advocate ,
Mar 13, 2015

Copy link to clipboard

Copied

When you run the page which button are you clicking first?

Where did you get this sample from?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 13, 2015 0
Chaz__W LATEST
New Here ,
Mar 13, 2015

Copy link to clipboard

Copied

I am clicking on the stocksSubscribe button:

I got this sample from this site: Using WebSocket to broadcast messages - ColdFusion, English documentation - Adobe Learning Resources

thanks,

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 13, 2015 0