From 5d9cd96defbb48b12f4a2ba528ec41c7286e1a32 Mon Sep 17 00:00:00 2001 From: Gerd Flaig Date: Sun, 22 Mar 2009 15:42:50 +0100 Subject: [PATCH] Add notes on COMET --- Notes | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Notes diff --git a/Notes b/Notes new file mode 100644 index 0000000..84450c8 --- /dev/null +++ b/Notes @@ -0,0 +1,28 @@ +On COMET w/ hunchentoot: http://common-lisp.net/pipermail/tbnl-devel/2009-February/004620.html + +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))) -- 2.43.0