cfwebsocket cannot find channels

326 Views Asked by At

I have just started a project at work using cfwebsockets. When I attempt to subscribe to the channel I set in the Application file <cfset this.wschannels = [{name="notify"}]> I get the following response in chrome:

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

Why would it not be finding it? Here is more of my code for reference.

<cfwebsocket name="notify" onOpen="subscribeUser" onMessage="msgHandler" onError="errHandler">

<script>
    function errHandler(err){
        console.log(err);
    }
    function msgHandler(message){
        var data = message.data;
        if(data){
        }
    }
    function subscribeUser(){
        console.log(notify);
        notify.subscribe("notify",{name: '#Session.Auth.FirstName#',UserID: '#Session.Auth.UserID#',LocationID: '#Session.Auth.LocationID#'});
    }
    function publish(txt, msgType){
        var msg = {message: txt, UserID: '#Session.Auth.UserID#', type: msgType};
        var headers = {selector: 'LocationID eq "#Session.Auth.LocationID#"'};
        notify.publish('notify',msg, headers);
    }

</script>
0

There are 0 best solutions below