Coldfusion 10 - Live Chat with Websites

Does anyone know of any examples or pages that I can use to implement Live in one chat using CF10 websites? All the examples that I found on the network were those that were in group chats, where users subscribed to a specific channel. I need this, so there may be many cases of one chat, for example, how the Live Help chat works, which you often see on websites that allow you to communicate with one of the support agents. Any help is appreciated and hopefully there will be examples (CF and JS).

+7
source share
3 answers

Ben Nadel has a good article on using CF10 websites to push a message to a target user . He even added a good demo video. This may be what you are looking for, or at least help you get started.

+2
source

Here is a sample code that currently works for me.

Instead of using the subscribeTo attribute, use the js function to subscribe to the user and pass some header values. These headers can then be used as filters when invoking a publication using selector

Example:

 <cfwebsocket name="ChatSocket" onOpen="openHandler" onMessage="msgHandler" onError="errHandler"> <script> function openHandler(){ //Subscribe to the channel, pass in headers for filtering later ChatSocket.subscribe('chatChannel',{name: '#Session.Auth.FirstName#', UserID: '#Session.Auth.UserID#', AccountID: '#Session.Auth.AccountID#' }); } function publish(txt, userID){ var msg = { AccountID: "#Session.Auth.AccountID#", publisher: '#Session.Auth.UserID#', id: userID, message: converthtml(txt) }; //When including headers, the "selector" is where you will filter who it goes to. var headers = { AccountID: "#Session.Auth.AccountID#", publisher: '#Session.Auth.UserID#', id: userID, selector: "UserID eq '"+userID+"' and AccountID eq '#Session.Auth.AccountID#'" }; ChatSocket.publish('chatChannel',msg, headers); } function msgHandler(message){ console.log(message); } function errHandler(err){ console.log(err); } </script> 
+1
source

At first I thought about implementing something similar, but there are currently some vestigial limitations in CF10 that are deceiving me from further study.

I would look elsewhere for any serious individual chat solution, possibly Socket.IO in NodeJS or Java

WSS may be received in CF11. I'm not sure.

+1
source

All Articles