This is a really light wrapper for the PubNub API. It comes with a simple demo. You can delete controllers/, views/ and routes.php if not needed.
'pubnub' => array(
'auto' => true,
// Want to use the demo?
'handles' => 'pubnub',
)
- Edit config/pubnub.php
- Call PubNub using the IoC Resolver.
You can use use any functionality provided by PubNub.
IoC::resolve('pubnub')->publish(array(
'channel' => 'my_channel',
'message' => array( 'my_var' => 'my text data' )
));
IoC::resolve('pubnub')->subscribe(array(
'channel ' => 'my_channel',
'callback' => function($message) {
var_dump($message['my_var']); // print message
return true; // keep listening?
}
));
$messages = IoC::resolve('pubnub')->history(array(
'channel' => 'my_channel',
'limit' => 10
));