PubNub::PubSub::Message - Message object for PubNub::PubSub
This module is primarily used behind the scenes in PubNub::PubSub. It is not intended to be used directly for users. This being said, one can use it if you want to do your own URL management or otherwise interface with PubNub in ways this distribution does not yet support.
my $datastructure; my $message = PubNub::PubSub::Message->new(payload=> $datastructure); my $json = $message->json; my $payload = $message->payload; my $queryhash = $message->query_params;
THis is the basic constructor. Requires message or payload argument. Message is effectively an alias for payload. Other arguments include ortt, meta, ear, and seqn, supported per the PubNub API. These other arguments are converted to JSON in the query_params method below.
If a simple scalar is passed (not a reference), it is assumed that this will be passed to PubNub as a string literal and handled appropriately.
Returns the message payload
Returns a message object with a payload from a json string.
Returns the payload encoded in json via Mojo::JSON
Returns a hash of query param properties (ortt, meta, ear, seqn), json-encoded, for use in constructing URI's for PubNub requests.
To install PubNub::PubSub, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PubNub::PubSub
CPAN shell
perl -MCPAN -e shell install PubNub::PubSub
For more information on module installation, please visit the detailed CPAN module installation guide.