[hunchentoot-devel] COMET with Hunchentoot?

William Halliburton whalliburton at gmail.com
Thu Feb 26 22:28:38 UTC 2009


I have a working comet system using Hunchentoot.

The basic way I'm operating is to have the browser contact the hunchentoot
server and the server thread waits on a semaphore. Any other thread can then
release the semaphore and cause a reply back to the browser.

Hope this helps. I am only using this for development purposes, as I have
been having problems with certain browsers, and this will also occupy one of
the available browser requests, where many browsers have a very small number
available.

(defun kill-comet-thread (thread)
  (warn "KILLING COMET THREAD: ~a" thread)
  (ignore-errors
    (destroy-thread thread)))

(defun handle-comet ()
  (awhen (session-value 'comet-thread) (kill-comet-thread it))
  (setf (session-value 'comet-thread) *current-thread*)
  (wait-on-semaphore (session-value 'comet-semaphore))
  (setf (session-value 'comet-thread) nil)
  (aif (session-value 'comet-fn) (funcall it)))

(defun comet (fn &optional (session *working-session*))
  (setf (session-value 'comet-fn session) fn)
  (signal-semaphore (session-value 'comet-semaphore session)))



On Thu, Feb 26, 2009 at 4:01 PM, Jim Prewett <download at hpc.unm.edu> wrote:

>
> Hello,
>
> I'm not quite sure what I'm after except that the buzzword seems to be
> "COMET".
>
> AFAICT, much of the time, this involves having javascript send an
> XMLHttpRequest to the server which the server keeps open until there is
> data to be sent to the client.
>
> Has anyone done anything like this?  Does anyone have thoughts on how one
> might implement something along these lines?
>
> All I am really after is some sort of "Server Push" - I'd be happy to hear
> any thoughts anyone has along these lines.
>
> Thanks,
> Jim
>
> James E. Prewett                    Jim at Prewett.org download at hpc.unm.edu
> Systems Team Leader           LoGS: http://www.hpc.unm.edu/~download/LoGS/<http://www.hpc.unm.edu/%7Edownload/LoGS/>
> Designated Security Officer         OpenPGP key: pub 1024D/31816D93
> HPC Systems Engineer III   UNM HPC  505.277.8210
>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20090226/4b281f40/attachment.html>


More information about the Tbnl-devel mailing list