NAME
PubNub::PubSub::Message - Message object for PubNub::PubSub
SYNOPSIS
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;
METHODS
new
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.
payload
Returns the message payload
from_msg($json_string)
Returns a message object with a payload from a json string.
json
Returns the payload encoded in json via Mojo::JSON
query_params($mergehash)
Returns a hash of query param properties (ortt, meta, ear, seqn), json-encoded, for use in constructing URI's for PubNub requests.