User Guide Cancel

WSPublish

 

Description

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

Category

Other functionsSystem functionsData output functions

History

ColdFusion 11: Added the parameter clustered

ColdFusion 10: Added this function

Syntax

WSPublish(channel,message,[filterCriteria="",clustered=false])
WSPublish(channel,message,[filterCriteria="",clustered=false])
WSPublish(channel,message,[filterCriteria="",clustered=false])

Parameters

Parameter

Description

channel

Specific channel to which the server publishes its response.

message

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

filterCriteria

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

clustered

If true, fetches subscriber information from all configured nodes.

Example

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

Get help faster and easier

New user?