Skip to content

Instantly share code, notes, and snippets.

@andreacfm
Created February 3, 2011 21:01
Show Gist options
  • Save andreacfm/810191 to your computer and use it in GitHub Desktop.
Save andreacfm/810191 to your computer and use it in GitHub Desktop.
fake data push for the websockets stock example
<cfsetting requesttimeout="120">
<cfscript>
param name="gateway" default="stocks";
stocks = ['GOOG','APPL','MSFT','AMZN'];
thread action="run" name="stock_thread" stocks="#stocks#"{
while(true){
message = {};
for(item in attributes.stocks){
message[item] = randRange(1,5);
}
data = {message : serializeJSON(message)}
sendGatewayMessage(gateway,data);
sleep(2000);
}
}
writeOutput('<h3>Data push started</h3>');
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment