xo::MessageRelay method start_of_page (protected)

 <instance of xo::MessageRelay[i]> start_of_page mode

Defined in packages/xotcl-core/tcl/message-relay-procs.tcl

Compose reply header.

Parameters:
mode (required)

Testcases:
No testcase defined.
Source code:
if {$mode eq "scripted"} {
  #
  # Scripted streaming relies on an infinitely long request,
  # providing chunks of javascript code conveying the
  # message. Widely supported e.g. also by Internet Explorer,
  # but not recommended on modern browsers.
  #
  set content_type "text/html;charset=utf-8"
  set encoding "Cache-Control: no-cache\r\nTransfer-Encoding: chunked\r\n"
  set body "<html><body>[string repeat { } 1024]\r\n"
  set body [format %x [string length $body]]\r\n$body\r\n
  return "HTTP/1.1 200 OK\r\nContent-type: $content_type\r\n$encoding\r\n$body"
} else {
  #
  # Other modes will use Server Sent Events.
  #
  return [append _  "HTTP/1.1 200 OK\r\n"  "Cache-Control: no-cache\r\n"  "X-Accel-Buffering': no\r\n"  "Content-type: text/event-stream\r\n"  "\r\n"]
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: