MoSync 3.3
Wormhole::MessageProtocol Class Reference

Class that checks a Wormhole protocol. More...

#include <Wormhole/MessageProtocol.h>

List of all members.

Public Member Functions

 MessageProtocol (MAHandle dataHandle)
virtual ~MessageProtocol ()
bool matches (const char *protocol)
bool isMessageStream ()
bool isMessageStreamJSON ()

Protected Attributes

char mProtocol [3]

Detailed Description

Class that checks a Wormhole protocol.

This class checks the three character protocol specified as part of a message sent from a WebView as a MAW_EVENT_WEB_VIEW_HOOK_INVOKED event, using one of the send methods in mosync-bridge.js.

The prefix has the format "xx:", for example "ma:".

Standard protocol prefixes are:

"ma:" MessageStreamJSON (sent with function mosync.bridge.sendJSON

"ms:" MessageStream (sent with function mosync.bridge.send)

Note: "ma" is short for "message array", since JSON message objects are sent as an array.

You can also use your own prefix and send the message string using function mosync.bridge.sendRaw. The prefix must be two characters plus a colon if you wish to use this class. Use the MessageProtocol::matches method to check for the presence of your own message protocol.

TODO: Add copy constructor and assignment operator.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines