The publish() function is used to send a message to all subscribers of a channel. To publish a message you must first specify a valid publishKey at initialization. A successfully published message is replicated across the PubNub Real-Time Network and sent simultaneously to all subscribed clients on a channel.
Messages in transit can be secured from potential eavesdroppers with SSL/TLS by setting ssl to true during initialization.
You can still use the native Pubnub JavaScript SDK if you feel this will be more suitable for your situation.
Your HTML page will include 2 key libraries:
The fire endpoint allows the client to send a message to BLOCKS Event Handlers. These messages will go directly to any Event Handlers registered on the channel that you fire to and will trigger their execution. The content of the fired request will be available for processing within the Event Handler. '
The message sent via fire() is not replicated, and so will not be received by any subscribers to the channel. The message is also not stored in history.
To set/get UUID you can use the following method(s) in AngularJS V4 SDK
Pubnub Angular service is a wrapper for PubNub JavaScript SDK that adds a few extra features to simplify Angular integrations:
This function causes the client to create an open TCP socket to the PubNub Real-Time Network and begin listening for messages on a specified channel. To subscribe to a channel the client must send the appropriate subscribeKey at initialization.
By default a newly subscribed client will only receive messages published to the channel after the subscribe() call completes.
When subscribed to a single channel, this function causes the client to issue a leave from the channel and close any open socket to the PubNub Network. For multiplexed channels, the specified channel(s) will be removed and the socket remains open until there are no more channels remaining in the list.
Unsubscribing from all the channel(s) and then subscribing to a new channel Y is not the same than Subscribing to the channel Y and then unsubscribing from the previously subscribe channel(s). Unsubscribing from all the channels resets the timetoken and thus, there could be some gaps in the subscription that may lead to a message loss. |
To set/get UUID you can use the following method(s) in AngularJS V4 SDK
Pubnub Angular service is a wrapper for PubNub JavaScript SDK that adds a few extra features to simplify Angular integrations:
Unsubscribe from all channels and all channel groups
unsubscribeAll()
Pubnub.unsubscribeAll();
None
You can be notified of connectivity status, message and presence notifications via the listeners.
Listeners should be added before calling the method.
unsubscribeAll()
Pubnub.unsubscribeAll();
None