Developer's Guide

Down to the details

Embedding the client

To enable Beaconpush on your web site you need to include our JavaScript client. The client will connect to Beaconpush using the best transport it see fit - be it WebSockets, Comet or Flash. With a connection established, your web page's visitors will start receiving messages sent through Beaconpush.

Use the API test page or integrate Beaconpush into your favorite web framework. It's all REST, you know! For the duration of your users on the web page, the connection will remain open.

A descriptive example

Include the line below before the closing </body> tag on your web page. We recommend you serving this client from our servers to ensure compatibility between updates.

<script type="text/javascript" src="http://cdn.beaconpush.com/clients/client-1.js"></script>

The second step is to configure the JavaScript client.

<script type="text/javascript">
    Beacon.connect('b58ae219', ['frontpage', 'chat'], {log: true});
    Beacon.listen(function (message) { alert(message); });
</script>

In short, this will connect to Beaconpush using the API key 'b58ae219', listening to the channels 'frontpage' and 'chat'. Logging will be enabled as you can see by the last argument. A callback function is also attached to get notified when new messages arrive. Simple, eh?

JavaScript API

Beacon.connect(apiKey, channels, options)

Connects to Beaconpush and starts listening for messages. Usually the first function to get called.

apiKey: Your API key (found under Settings).
channels: Array of channels you want to subscribe to. Each entry should a string with a valid channel name.
options: Object of options. Supports 'log' and 'user'. You can set 'log' to 'true' to enable Firebug logging. 'user' can also be set to a string, overriding the generated user ID.

Beacon.listen(handler)

Registers a callback handler that will get called when new messages arrive. You can attach multiple listeners by calling this method multiple times.

handler: A JavaScript function with the 'function (message)' signature.

Beaconpush - Real-time in the cloud. Take the tour and sign up now.

Sign up for the beta

We're currently in private beta. If you'd like to be considered for a private beta invitiation, gives us your details below.


Your e-mail:

How did you hear about us?

Login


E-mail
Password


No account yet? Sign up now, it's free.
Try resetting your password if you forgot it.

Reset Password


In case you forgot your password, you can try resetting by entering the e-mail address you signed up with.

E-mail

Sign up for an account

To get started with real-time push, fill out this form and be on your way.
No credit card required! And no, we won't be sending you any spam.



Your full name
E-mail
Password