Quickstart
1. Create an app
Section titled “1. Create an app”In the console, open Hive Realtime and click New app. Give it a name and pick the region closest to your users. The app page shows its App ID, Key, Host and, on request, its Secret.
The host is realtime-<region>.dockhive.io, for example realtime-eu.dockhive.io. The key and host are safe to put in browser and mobile apps; keep the secret on your server.
2. Connect a browser
Section titled “2. Connect a browser”npm install pusher-jsimport Pusher from 'pusher-js';
const pusher = new Pusher('YOUR_APP_KEY', { wsHost: 'realtime-eu.dockhive.io', wsPort: 443, wssPort: 443, forceTLS: true, enabledTransports: ['ws', 'wss'], cluster: 'eu',});
const channel = pusher.subscribe('orders');channel.bind('order-shipped', (data) => { console.log('Shipped:', data);});3. Send an event from your server
Section titled “3. Send an event from your server”npm install pusherimport Pusher from 'pusher';
const pusher = new Pusher({ appId: 'YOUR_APP_ID', key: 'YOUR_APP_KEY', secret: process.env.REALTIME_SECRET, host: 'realtime-eu.dockhive.io', useTLS: true,});
await pusher.trigger('orders', 'order-shipped', { id: 1042 });composer require pusher/pusher-php-server$pusher = new Pusher\Pusher( 'YOUR_APP_KEY', getenv('REALTIME_SECRET'), 'YOUR_APP_ID', ['host' => 'realtime-eu.dockhive.io', 'port' => 443, 'scheme' => 'https', 'useTLS' => true]);
$pusher->trigger('orders', 'order-shipped', ['id' => 1042]);For Laravel broadcasting, set these in .env and use BROADCAST_CONNECTION=pusher:
PUSHER_APP_ID=YOUR_APP_IDPUSHER_APP_KEY=YOUR_APP_KEYPUSHER_APP_SECRET=YOUR_APP_SECRETPUSHER_HOST=realtime-eu.dockhive.ioPUSHER_PORT=443PUSHER_SCHEME=httpsPUSHER_APP_CLUSTER=eupip install pusherimport osimport pusher
client = pusher.Pusher( app_id='YOUR_APP_ID', key='YOUR_APP_KEY', secret=os.environ['REALTIME_SECRET'], host='realtime-eu.dockhive.io', ssl=True,)
client.trigger('orders', 'order-shipped', {'id': 1042})Open the app’s Debug console in DockHive to watch connections, subscriptions and events as they happen.