On dinsdag 27 december 2011 16:19:19, Alan Williamson (aw2.0 cloud experts) wrote:
i have been looking into this world for some time now, and haven't yet come up with a clean way of exposing this layer to CFML.

David Mulder wrote:
Just a thought, if you would be working on top of Jetty, you might want to consider looking into it's support for websockets/cometD (although that would require a fair bit of java cfscripting), as that means you don't need to poll the server, but rather you push out the new messages from the server to the clients (well, if their browsers support the websocket protocol it will be a real push, otherwise it's a as fast as a push, but it actually uses long polling (or in netscape and firefox it uses x-mixed-replace)). Or move away from coldfusion entirely and use something like node.js and you will be up and running in a few hours :P (either with comet technologies (see socket.io) or with long polling (see chat.nodejs.org inc. source code) ) .
David Mulder



From a syntaxual point of view? Now that I think about it, no matter how you set it up, it will be quite ugly either way, due to the very nature of cfml. Still, as far as a pure websocket implemention would go (without any other comet support) it would probably look a lot like the cfsmtp tag, you would register a cfc with a onConnect, onDisconnect and onMessage and a function to send messages (and maybe a few tools to simplify connection handling etc.). The big difference would be that this cfc would be saved in the session/application scope, rather than a new one for every request. The downside to this would be that it wouldn't work in older browsers, however rebuilding socket.io from scratch seems to be a bit too much :P . <cfwebsocket action="start" port="8000" component="cfc.socket"></cfwebsocket>
Ideally of course it would be possible to do
<cfwebsocket action="start" port="8000" component="cfc.socket">
 <cffunction name="onConnect">
 </cffunction>
</cfwebsocket>
but as far as I know that wouldn't be possible on top of the structure of openbd (but I am extremely new to openbd, so I might be mistaken).

Next you could even go as far as exposing some extra client side libraries to simplify stuff as ACF tends to do, but if you would go for a pure websocket implementation that shouldn't really be necessary, though I could think of a number of exotic implementations which would extend the base cffunction + cfcomponent (to some extend similar to what ACF's ajax implementation does). Oh well, just some random thoughts :P
 David Mulder

--
online documentation: http://openbd.org/manual/
  google+ hints/tips: https://plus.google.com/115990347459711259462
    http://groups.google.com/group/openbd?hl=en

Reply via email to