rough thing for testing. nothing to see here. A native browser client is in the works. (TODO: bug number)
To use the client, first run the example found in the server repository. Then you should be able to open the example page here and connect.
Options may include:
pushServer
: the WebSocket URL of the SimplePush server the client should connect touaid
: a unique UserAgent ID. Defaults to a random uuid (version 4).
Arguments:
cb
: fired once the client connects and completes the handshake
Arguments:
cb
: callback called with three arguments:- An error if any, or null
- A response object with
channelID
andpushEndpoint
keys - A channel object that can receive push notifications. Attach a
push
event handler to the channel object to receive the notifications. E.g.
client.register(function(err, reply, channel) {
console.log('Channel ID', reply.channelID);
console.log('Endpoint: ', reply.pushEndpoint);
channel.on('push', function(err, update) {
console.log('Reveived update:', update.version);
});
});
Arguments:
channelID
: The channel to unregistercb
: callback when unregistration completes