Receiver.onRegister( callback )

Use this method to pass a callback to a receiver which should be called when the receiver is connected to the server. The callback is called once, without arguments.


Callback Arguments



Code example

In the following example a receiver for a pong game is created with the "notification" parameter set to "none". This means that PlugPIN will not display the connection code in an overlay, so the developer has to do this herself. She has prepared a HTML element with the id "connection-code" to do this and as soon as the connection code is available she will display the code in that element.

var codeDisplay = document.getElementById( 'connection-code' );

var player = PlugPIN.createReceiver({
    "name" : "Play pong",
    "notification" : "none"

player.onRegister( function()
    codeDisplay.innerHTML = player.connectionCode;
} );



Contact us

Talk to us!
Tell us anything you want to and please add your contact information.

Our contact info
tel. +31 (0) 20 2170013

Groenhoedenveem 28
1019 BL Amsterdam
The Netherlands

News letter

Enter your e-mail address to stay informed on everything PlugPIN!