Created
February 3, 2011 21:01
-
-
Save andreacfm/810191 to your computer and use it in GitHub Desktop.
fake data push for the websockets stock example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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