Sitellite Application Framework
Class Tree         Index         All Elements

Class: ServerPush

Source Location: Program_Root/CGI/ServerPush.php

Class Overview


ServerPush is a class that implements Netscape's HTTP server push functionality, allowing incremental data to be presented to the visitor.


Author(s)

Version

  • 1.0, 2002-08-23, $Id: ServerPush.php,v 1.2 2005/07/06 15:30:56 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 66]
ServerPush is a class that implements Netscape's HTTP server push functionality, allowing incremental data to be presented to the visitor.

Please note that if you are using this class for progress meter-like purposes, for the sake of your bandwidth and for your users, do not send a message for each item being counted, instead wrap something like this around it:

if ($total > 1000 && $sent % floor ($total / 25) == 0) { $spush->send ('...', true); }


1 <?php
2
3 $spush = new ServerPush ('replace');
4
5 // display the message "Hello, how are you today?" one word at a time
6 // with a two second delay between words.
7 $spush->rotate (array (
8 'Hello,',
9 'how',
10 'are',
11 'you',
12 'today?',
13 ), 2);
14
15 ? >




Tags:

access:  public
version:  1.0, 2002-08-23, $Id: ServerPush.php,v 1.2 2005/07/06 15:30:56 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$contentType =

[line 84]

The HTTP content type of the pushed document. This can be either multipart/mixed or multipart/x-mixed-replace, depending on what you tell the constructor method.



Tags:

access:  public

Type:   mixed


[ Top ]

$key =

[line 74]

The unique key used to separate pushed data blocks. This value is generated on the fly for you.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor ServerPush [line 93]

ServerPush ServerPush( [string $type = 'mixed'])

Constructor method. $type can be either 'mixed', or 'replace'.



Tags:

access:  public


Parameters:

string   $type  

[ Top ]

method end [line 130]

void end( )

Prints a closing key string, ending the transmission.



Tags:

access:  public


[ Top ]

method rotate [line 148]

void rotate( associative $data, [integer $sleep = 1])

Sends a list of blocks with a delay of $sleep seconds

between them. This is the way web sites used to create basic animations back in the early days of the web, even before animated GIFs. $data is an associative array where the keys are the content type of the data value. If no content type is specified (ie. the array is not associative), then the content type will default to text/html.




Tags:

access:  public


Parameters:

integer   $sleep  
associative   $data   array $data

[ Top ]

method send [line 115]

void send( string $data, [boolean $more = true], [string $contentType = 'text/html'])

Sends a single block to the visitor. If $more is false, send() calls end() when it is done. $contentType is the content type for this specific block.



Tags:

access:  public


Parameters:

string   $data  
boolean   $more  
string   $contentType  

[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:19:11 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2