Receiver.destroy()

Use this method to remove a receiver.

 

Example

In the following example, a developer is building a game with a variable number of players. Receivers are created dynamically, so when a player detaches, the receiver should be cleaned up to prevent memory issues.

var receivers = {};

function addReceiver( name )
{
    receivers[ name ] = PLUGPIN
        .createReceiver( { "name" : name, "notification" : "none" } )
        .onAttach( function()
            addReceiver( createRandomName() )
        }
        .onDetach( function()
        {
            receivers[ name ].destroy();
        } );
};
 

 

 

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
info@plugpin.com

Groenhoedenveem 28
1019 BL Amsterdam
The Netherlands

News letter


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