(index ("define-page/sse" 0) ("send-sse-data" 1070) ("send-sse-retry" 1460))
(def (sig (procedure "(define-page/sse path contents sse-path sse-proc #!key css title doctype headers charset no-ajax no-template no-session no-db vhost-root-path no-javascript-compression use-ajax (method '(GET HEAD)) (use-sxml not-set) use-session)" (id define-page/sse))) (p "Define two awful pages:") (ul (li "The \"client page\" that is accessed via " (tt "path") " and presents " (tt "contents") ". It is a \"normal\" awful page and should be used as the link presented to the client;") (li "The \"server page\" that should be accessed by the \"client page\" via " (tt "sse-path") " using the appropiate Javascript code (see " (int-link "#examples" "Examples") " section). This page will run " (tt "sse-proc") ". ")) (p (b "Note") " that " (tt "sse-proc") " should keep the connection open, so usually it is an infinite loop. In order to avoid CPU consumption this loop should sleep some seconds and, for that, be sure to use SRFI-18 " (link "http://api.call-cc.org/doc/srfi-18/thread-sleep!" "thread-sleep!") " instead of blocking " (tt "sleep") " procedure."))
(def (sig (procedure "(send-sse-data data #!key event id)" (id send-sse-data))) (p "Send data from server to the client using the current HTTP connection. " (tt "event") " and " (tt "id") " keywords are used to set the data type and unique id respectively. When there is no " (tt "event") " field set, the client understands the data type is \"message\". " (tt "id") " is also optional."))
(def (sig (procedure "(send-sse-retry milliseconds)" (id send-sse-retry))) (p "Send the \"retry: " (tt "milliseconds") "\" message to define the reconnection timeout for the client."))
