Push Meta Tag

PocketBrowser 3.x API

The Push Meta Tag is used to receive data over an HTTP connection.

Push (META Tag) Syntax
<META HTTP-Equiv="Push" content="[Parameter>
<META HTTP-Equiv="Push" content="[Parameter:Attribute>
<META HTTP-Equiv="Push" contents="Detected:url('[jsFunction | url]')">

Items listed in this section indicate methods or, in some cases, indicate parameters which will be retrieved.

Name Description
Default Value
Start Starts the server. Must be after the <port> tag. N/A
Stop Stops the server. N/A
Copy methods template to clipboard: Copy META Tag template to clipboard META Tags Copy Javascript template to clipboard Javascript

Items listed in this section indicate parameters, or attributes which can be set.

Name Possible Values Description
Default Value
Port:[Value] 0 - 65535 Port number to listen on. 80
Passkey:[Value] Any string If specified then the client must include passkey=value in the passed parameters. Case sensitive. Empty (no passkey required)
Response:[Value] Filename Name of the HTML file to return to the client after a successful request. Empty (a short default HTML response is sent)
Path:[Value] Virtual path The client must include this in the HTTP request (after the address and before the parameters). The forward slash '/' should be used as the directory delimiter. Empty (any path is accepted)
Unattended:[Value] ENABLED or DISABLED Enables or disables unattended mode - see Remarks for details. DISABLED
Copy parameters template to clipboard: Copy META Tag template to clipboard META Tags Copy Javascript template to clipboard Javascript

Modules return information back to their web pages via retrieval tags, for example the scanner has a retrieval tag called 'DecodeEvent' which is called whenever it decodes a barcode. To register to receive a retrieval tag call the module as follows:

<META HTTP-Equiv="[Module]" content="[RetrievalTag]:url('[URI]')">
So to register to retrieve the Scanner's DecodeEvent the following syntax would be used:
<META HTTP-Equiv="Scanner" content="DecodeEvent:url('Javascript:doScan('%6', '%s', %3, '%2');')">

Retrieval tags return information by replacing the text in place holders, defined as '%s' or '%<number>'. Each place holder represents 1 return value with '%s' being populated sequentially or '%<number>' providing direct acces to the desired value.

If the content for the Scanner's DecodeEvent is:

"url('Javascript:doScan('%6', '%s', %3, '%2');')"

The function would be called as follows:
"Javascript:doScan('Decode', '5449000053879', 0x35, 'SCN:EAN13');"


ID Name Description
1 value One value is returned for each name=value pair in the HTTP request.
Copy this return value template to clipboard: Copy META Tag template to clipboard META Tags Copy Javascript template to clipboard Javascript

The code below configures the server to listen on port 8080, to accept only requests to the virtual path \push and to require a passkey of 'secret'. Assuming the device has IP address then browsing to the following URL will cause the Javascript function onPush() to be called with the parameters 'hello' and 'world': The browser will receive the contents of the file \ok.hmtl as response.

<META HTTP-Equiv="Push" Content="Port:8080">
<META HTTP-Equiv="Push" Content="Passkey:secret">
<META HTTP-Equiv="Push" Content="Path:/push">
<META HTTP-Equiv="Push" Content="Response:/ok.hmtl">
<META HTTP-Equiv="Push-Detected" Content="url('Javascript:onPush('%s','%s');')">
<META HTTP-Equiv="Push" Content="Start">
Copy example to clipboard Copy example to clipboard

To enable unattended mode:

<META HTTP-Equiv="push" Content="unattended:enabled">
Copy example to clipboard Copy example to clipboard
HTTP request format
The push server accepts both GET and POST requests. For GET requests the parameters and values are specified in the URL, while for POST requests the request body should hold the parameters and values in url encoded form. The virtual path in the URL must be as specified by the <path> tag, or can be anything if the tag isn't present. The parameters must include 'passkey' with the correct value if the <passkey> tag is present.

Returned values
When a valid request is received the specified destination URL is called with one '%s' per parameter/value pair in the request. Only the values are returned; the parameter names are discarded. The 'passkey' parameter and value are ignored if present.

Allowed characters
Only alphanumeric characters and the characters $-_.+!*'(), are allowed in a URL (see RFC 1738). Any other characters will cause undefined behaviour. Ensure that the passkey uses only valid characters.

Unattended mode
Normally when a device enters suspend mode, either because it has been idle for a certain time or because the power key was pressed, all the device subsystems are switched off, including the wireless network. When unattended mode is enabled however the device keeps enough subsystems powered that applications continue to run, and it can still respond to Push requests. Note that unattended mode uses significantly more battery power.

Supported Platforms Windows CE, Windows Mobile
Persistence This tag is persistent.
Min. Requirements Network Stack.