A real-time feed management system that enables the rapid
broadcasting of headlines
for applications in
social news,
TV,
music,
sports,
commerce and
finance.
<!-- EMBED CODE FOR VIEWER --> <script src="http://cdn.pubnub.com/pubnub.min.js"></script> <script src="http://cdn.pubnub.com/pubnub-crypto.min.js"></script> <script src="http://pubnub.github.io/bootstrap-content-curator/dist/js/pubnub-sync.js"></script> <script>(function(){ var settings = { subscribe_key : 'sub-459a5e4a-9de6-11e0-982f-efe715a9b6b8' , cipher_key : 'ODgwNDsmIzczMDustKOiJiM4NzM0O7aqSDNh2mig' , ssl : true }; var db = PUBNUB.sync( 'db-public', settings ); db.all(function(item){ /* -- render all items -- */ }); db.on.create(function(item){ /* -- render new item -- */ }); db.on.update(function(item){ /* -- update item -- */ }); db.on.delete(function(item){ /* -- remove item -- */ }); })();</script>
Write a text headline then press
"Submit"
or press Enter.
This will send your headlines
to the editor for
Publishing and Editing.
By pressing submit, you've just done something very powerful. Many synchronous steps execute, placing an amazing new DataSync capability at your fingertips faster than ever before. When you press the submit button, the code will execute as follows:
var item = db.create({ headline : "..." })
and therefore write a new db row entry onto the Editor Database. Next the editor will update the entry as needed:
item.update({ headline : "..." })
Both db.create()
and item.update()
will save the changes in memory,
on your local disk and to the
cloud all at the same time.
Once you re-connect to the database, any untransmitted changes
are sent to the device to sync data
in real-time.
Finally to publish simply write to a second DB, a public facing DB, that can be used for read-only updates.
db2.create({ headline : item.headline })
That's it for now with the intro tutorial. To learn more continue down this document for further reading.
Dropbox for your apps data powered by PubNub the worlds largest global Real-time Network. All changes are pushed directly to the app via an always-on Socket Connection in real-time as changes are made.
DataSync is the ability to have apps always be at the same-state regardless of point-of-load. Upon reconnect, all data is re-synced with the client app. Your data is replicated to all data centers and optionally encrypted.
Highly Available Global Real-time Network is mandatory for distributed consumers in order to provide a fast and reliable user experience. You can only get that fast "Snappy" feel with a Global Real-time Network.
Every event is replicated more than 500 times; extreme global reliability via a Real-time Network.
Security is a complex and widely growing requirement especially for Real-time Mobile and Web Messaging Systems like PubNub. SSL TLS Sockets, SHA256 Message Signing, PAM ACL Access Management and AES256 Symmetric Crypto are industry standard methods for providing High Levels of security for your application.
PubNub provides a default baseline level of security, with optional High Security with industry standard solutions for Signaling and DataSync applications.
Guaranteed DataSync to Mobile and Web Clients Dramatically simplifies app development. Schema-less NoSQL offers easy data entry without hindering productivity.
Up to 15ms Sync Delivery Speeds. PubNub announces JavaScript DataSync SDK. Many customers are using DataSync today on the PubNub Real-time Network. We made it even easier by offering an SDK enabling true DataSync powered by the worlds largest Global Real-time Network.
High speed reconnection times allow recovery of lost data in a snap. After a successful reconnect all pending read/write events are sync'ed.
PUBNUB.sync()
var settings = { publish_key : 'pub-5ad63a7a-0c72-4b86-978d-960dcdb971e1' , subscribe_key : 'sub-459a5e4a-9de6-11e0-982f-efe715a9b6b8' , secret_key : 'sec-fa847381-dcdb-4bcf-a8aa-7b812c390441' , cipher_key : 'ODgwNDsmIzczMDustKOiJiM4NzM0O7aqSDNh2mig' , ssl : true }; var db = PUBNUB.sync( 'db_name', settings );
You'll need some API Keys to play with. Start by following these easy steps:
Step | Action to Take |
---|---|
1 |
Signup For PubNub -
Signup/Login to
PubNub Admin Portal
Optionally Watch PubNub Basic Video 1 -
Registering for PubNub API Keys
|
2 |
Paste in your API Keys
and run PUBNUB.sync(...)
|
db.create({})
var item = db.create({ headline : "my header text" }); console.log(item.id);
db.read(id)
,
db.find({})
and
db.all()
// option 1 - get one item in DB var item = db.read(id); console.log(item); // option 2 - find items in DB var items = db.find({ headline : "match" }); console.log(items); // option 3 - print all items in DB var items = db.all(function(item){ console.log(item); });
item.update({})
// option 1 item.update({ headline : "some updated value" }); console.log(item); // option 2 db.update( item.id, { headline : "some updated value" } ); console.log(item);
item.update({})
or
if you know the ID of the item
then you can execute db.update( id, {} )
via the DataSync DB instance.
item.delete()
// option 1 item.delete(); // option 2 db.delete(item.id);
item.delete()
with
no arguments specified, or
if you know the ID of the item
then you can execute db.delete(id)
via the DataSync DB instance.
db.on.create()
db.on.create(function(item){ console.log(item); });
db.on.update()
db.on.update(function(item){ console.log(item); });
db.on.delete()
db.on.delete(function(item){ console.log(item); });
from Pubnub import Pubnub import uuid ## Initiate Class pubnub = Pubnub( publish_key=publish_key, subscribe_key=subscribe_key, secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on ) ## Create item_id = str(uuid.uuid4()) info = pubnub.publish({ 'channel' : 'db-public', 'message' : { 'id' : item_id, 'domain' : 'server', 'command' : 'create', 'data' : {'headline':'sample'} } }) print(info) ## Update info = pubnub.publish({ 'channel' : 'db-public', 'message' : { 'id' : item_id, 'domain' : 'server', 'command' : 'update', 'data' : {'headline':'updated!'} } }) print(info) ## Delete info = pubnub.publish({ 'channel' : 'db-public', 'message' : { 'id' : item_id, 'domain' : 'server', 'command' : 'delete' } }) print(info)
<?php require_once('Pubnub.php'); $pubnub = new Pubnub( $publish_key, $subscribe_key, $secret_key, $cipher_key, $ssl_on ); ## Create Row $item_id = uuid(); $pubnub->publish(array( 'channel' => 'testChannel', 'message' => array( 'id' => $item_id, 'domain' => 'server', 'command' => 'create', 'data' => array( 'headline' => 'sample' ) ) )); ## Update Row $pubnub->publish(array( 'channel' => 'testChannel', 'message' => array( 'id' => $item_id, 'domain' => 'server', 'command' => 'update', 'data' => array( 'headline' => 'updated!' ) ) )); ## Delete Row $pubnub->publish(array( 'channel' => 'testChannel', 'message' => array( 'id' => $item_id, 'domain' => 'server', 'command' => 'delete' ) )); function uuid() { if (function_exists('com_create_guid') === true) { return trim(com_create_guid(), '{}'); } return sprintf( '%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535) ); } ?>
Grab the files from GitHub: PubNub PHP Libraries
curl https://raw.github.com/pubnub/php/master/3.4/PubnubAES.php > PubnubAES.phpThis app: created and maintained by PubNub and Stephen Blum.