QRpu.sh offers a JavaScript API for sending and receiving messages. The client code is open source.

Returns a promise that will resolve with a channel once it is ready to accept a message.

Used to start a connection with the push servers.

Wait to receive a message over the channel. This returns a promise that will complete when a sender has sent a message over the channel.

Sending a message

qrPush.send(message, pushURL = undefined)

Used to send a message over the referenced channel.

The message will be serialised as JSON to be sent to the receiver.

Normally no pushURL needs to be specified as it will be inferred from the page url.