0

cfwebsockets を使用して職場でプロジェクトを開始したところです。アプリケーション ファイルで設定したチャネルをサブスクライブしようとすると<cfset this.wschannels = [{name="notify"}]>、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

なぜそれを見つけられないのでしょうか?これが参照用の私のコードの詳細です。

<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>
4

0 に答える 0