Monday, November 08, 2010 at 12:00 AM.
scripting2Suite.server.pushRealtimeUpdate
on pushRealtimeUpdate (htmltext, type="", userWhoCausedUpdate="", data=nil) {
<<Changes
<<7/20/10; 6:35:41 AM by DW
<<Call the builtins.realtime routine that was cribbed from this one.
<<old code
<<local (adrsystemdata = scripting2suite.init (), adruser, now = clock.now ())
<<local (semaphore = scripting2Suite.data.misc.realtimeSemaphore)
<<for adruser in @adrsystemdata^.server.users
<<if adruser^.prefs.flRealtimeUpdates
<<local (username = nameof (adruser^))
<<local (adrparent = @system.temp.scripting2.server.users.[username].realtimeUpdates, adrtable)
<<local (serialnum = adruser^.stats.ctRealtimeUpdates++)
<<for adrtable in adrparent
<<local (adrupdate = @adrtable^.[string.padwithzeros (serialnum, 5)])
<<semaphore.lock (semaphore, 180)
<<new (tabletype, adrupdate)
<<adrupdate^.htmltext = htmltext
<<adrupdate^.type = type
<<adrupdate^.username = userWhoCausedUpdate
<<if data != nil
<<adrupdate^.data = data
<<adrupdate^.when = now
<<semaphore.unlock (semaphore)
<<7/16/10; 7:43:21 AM by DW
<<Add another level under each users' realtimeUpdates table, with the IP they're connecting through.
<<7/15/10; 8:08:43 AM by DW
<<Add three optional params, type and userWhoCausedUpdate and data. Type of course can distinguish between classes of updates. I added this so the instant outliner could push its updates out through this channel. userWhoCausedUpdate indicates which user caused the update.
<<data is any data that should be attached to the update. It's up to the type to determine what data it might want to send.
<<7/13/10; 7:56:37 AM by DW
<<Created.
return (realtime.server.pushUpdate (htmltext, type, userWhoCausedUpdate, data))};
bundle { //test code
pushRealtimeUpdate ("Hello from Hollywood")}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.