PushRouter_RegisterClient
This function registers a push router client with the push router registration table.
HRESULT PushRouter_RegisterClient(
LPCTSTR szContentType,
LPCTSTR szAppId,
LPCTSTR szPath,
LPCTSTR szParams
);
Parameters
szContentType
[in] Pointer to the content type of the messages routed to the push router client. The type is designated in a message header that identifies the push router client in the push router registration table.Note For details about the Content-Type header, refer to WAP Specification "WAP-251-PushMessage-20010322-a.pdf" at this OMA website/.
szAppId
[in] Pointer to the push application ID of the push router client. The ID is designated in a message header that identifies the push router client in the push router registration table.Note For details about the Push Application ID, refer to WAP Specification "WAP-251-PushMessage-20010322-a.pdf" at this OMA website/.
szPath
[in] Pointer to the push router client's executable file path.szParams
[in] Pointer to command line parameters passed to the push router client.
Return Values
Returns S_OK if successful. If the function is unsuccessful, it can return a standard Windows HRESULT value or one of the push router-specific HRESULT values shown in the following table.
Value | Description |
---|---|
PUSHRTR_E_ALREADYREGISTERED | Another client is already registered with the same application ID and content type combination. |
PUSHRTR_E_EXCEPTION | An exception occurred in the push router function. |
Remarks
For your push router client to receive WAP push messages, you must register it with the push router registration table. The push router client can be registered to the push router in two ways: by using the PushRouter_RegisterClient function, or by manually editing the push router registration table entries in the registry.
Note Use the PushRouter_RegisterClient function when you plan to store your push router client code directly in ROM.
During registration, the push router client must specify the types of routing entries it will be using: the push router client's content type, its push application ID, or both. The client makes one registration call per registration type. In other words, it makes one call for the content type, one call for the application ID, or one call for a combination of content type and application ID (three calls in all).
If your application is a privileged application, and another application is already registered with the same content type or application ID, the new registration will overwrite the old one.
Message routing priority is given to push router clients that register both content type and application ID. If the Content-Type and AppID headers do not agree, the push router will route the message based on the AppID header.
Example
The following example demonstrates how to register a privileged application with the push router. The name of the application is "sample.exe," and it handles messages with the application ID "sample-app-id," and content type "text/xml."
The Trust parameter identifies the trust level of the application (2 for privileged, and 1 for not). The RefCount parameter states the number of routing entries this application uses for registration (3 in this example — Application ID, Content-Type, and the combination of Application ID and Content-Type).
Note A unique ID (such as a GUID) must be used to identify this registry key.
In your implementation, replace the text within brackets with your own.
[HKEY_LOCAL_MACHINE\Security\PushRouter\Registrations\ByGenericId\3EC5C506-A75E-4fd8-855A-4F89DDCD5438]
"GenId"="3EC5C506-A75E-4fd8-855A-4F89DDCD5438"
"AppId"="sample-app-id"
"Path"="sample.exe"
"Params"=""
"ContentTypes"="text/xml"
"RefCount"=dword:3
"Trust"=dword:2
The three routing entries this application uses for registration are as follows:
[HKEY_LOCAL_MACHINE\Security\PushRouter\Registrations\ByCTAndAppId\text/xml;sample-app-id]
@="3EC5C506-A75E-4fd8-855A-4F89DDCD5438"
[HKEY_LOCAL_MACHINE\Security\PushRouter\Registrations\ByCTAndAppId\text/xml;]
@="3EC5C506-A75E-4fd8-855A-4F89DDCD5438"
[HKEY_LOCAL_MACHINE\Security\PushRouter\Registrations\ByCTAndAppId\;sample-app-id]
@="3EC5C506-A75E-4fd8-855A-4F89DDCD5438"
Requirements
Pocket PC: Windows Mobile 2003 and later
Smartphone: Windows Mobile 2003 and later
OS Versions: Windows CE .NET 4.2 and later
Header: Pushclient.h.
Library: Pushprxy.lib.
See Also
Send Feedback on this topic to the authors