wsPublish

Sends messages to a specific channel based on the filter criteria (which is a struct).

wsPublish(String channel, Object message); wsPublish(channel,message [,filterCriteria]); → returns void

This function requires Adobe ColdFusion 10 and up.  Not supported on Lucee, etc.

Argument Reference

channel string
Required

Specific channel to which the server publishes its response.

message any
Required

Response sent by the server to all clients subscribed to a specific channel.

filterCriteria struct

Conditions to filter eligible clients that need to be notified for a given channel.

Examples
Sample code invoking the wsPublish function

Checking to see if the region is present in the cache

<cfscript> 
 if(isDefined('form.publish')) 
 wsPublish(#form.channel#, #form.message#); 
 </cfscript> 
 <cfform method='post'> 
 <cfselect name='channel'> 
 <option> 
 stocks 
 </option> 
 <option> 
 news 
 </option> 
 <option> 
 products 
 </option> 
 </cfselect> 
 Message: 
 <input id='message' name='message' type='text'> 
 <cfinput id='publish' name='publish' value='publish' type='submit'> 
 </cfform> 

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub