The PLUGPIN object

This is the base object. It is used solely to create Receiver objects from. When you include the PlugPIN script in your app, the PLUGPIN object is automatically available in the global scope. This object has two getters (values your can read, but not write) and only one method.

When PLUGPIN is loaded in a browser that does not support WebSockets or if WebSockets can not be used for another reason, the PLUGPIN variable will be set to null. It is therefore a good idea to place your PLUGPIN code inside or after an if-block that asserts the value of the global PLUGPIN variable.

 

Methods

PLUGPIN.createReceiver()

Expects an object with parameters. Returns a new Receiver object.

more

 

Code example

In the following example, a developer is creating a snake game. She wants people to connect with their smartphone, because she thinks that will be more fun. She creates a receiver called "Player 1" and then logs the receiver count to the browser console to check if everything is as it's supposed to be.

var player1 = PLUGPIN.createReceiver({
    "name" : "Player 1"
});

 
 

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!