[hunchentoot-devel] Re: Current development

Lars Rune Nøstdal larsnostdal at gmail.com
Wed Jun 11 12:35:16 UTC 2008


Bjørn Nordbø wrote:
> 
> On 2008-06-10, at 9:00 PM, Lars Rune Nøstdal wrote:
>>
>> Ok. Yeah, maybe a Comet module for HT would be of interest. I really 
>> hate promising things, but I might give it a try; I mean, attempt make 
>> it modularized and not hardwired into SymbolicWeb .... x)
> 
> 
> It's interesting to read about your efforts as we discussed Comet
> as a way to implement real time streaming to our Ajaxy mobile
> application yesterday.  In fact I started writing a Comet module
> for it almost a year ago (only a naive test), but the interest
> vaned as the only mobile device that worked with it was the
> iPhone.
> 
> But I was just thinking of looking at it again as the situation
> on the client side may have improved since then.  And, of course,
> the iPhone is finally coming to Norway.
> 
> Anyway, my point is that since there are two developers in Norway
> that have interest in Hunchentoot/Comet, there has to be hundreds
> if not thousands! worldwide. :-)
> 
> --Bjørn Nordbø
> 
> 

..hehe x)

Ok, way early, but something like this:
  http://paste.lisp.org/display/62069

It works, but it's not finished. .. I'll document it later and provide a small example (that depends on HT only). There are really just two new exported symbols; COMET-SERVER and WITH-DELAYED-RESPONSE.

Instead of using START-SERVER one have got to do:

  (tbnl::start (make-instance 'tbnl:comet-server :port 6001))


..the reason for this is that it seems START-SERVER doesn't accept a custom server designator at the moment.

The other exported symbol, WITH-DELAYED-RESPONSE, works something like this from inside a normal handler function:

  (with-delayed-response (stream *comet-delay-in-secs* closure
                                 (setf (comet-closure-of session) closure))
    (if (comet-message-exists-p session)
        (princ (comet-message-of session) stream)
        (princ "no message - but keep on polling, mr. client!" stream)))


Then something like this:

  (defun say (msg)
    (push msg (comet-message-of session))
    (when (comet-closure-of session)
       (funcall (comet-closure-of session))))


..ok, now I gotta start dealing with the connections proper, and logging etc.

-- 
Lars Rune Nøstdal
http://nostdal.org/




More information about the Tbnl-devel mailing list