Add NFC-like functionality to your browser with this Javascript API for Linccer.
Add the script to your website:
<script src="http://linccer.sandbox.hoccer.com/v3/linccer.min.js" type="text/javascript" charset="utf-8"></script>Then initialize a new linccer object. The Linccer methods takes an options hash. An API key must be specified, additionally it can be toggled between the production and the sandbox server.
You should use the sandbox server for development, you must use the production server in a shipping product (just omit the server option).
var linncer = Linccer({"api_key": "your_api_key", "server": "sandbox" });If you use Linccer in a browser which supports the geolocation api (navigator.geolocation object),
the location will be set automatically. Otherwise the location can be set manually.
if (!Linccer.autoLocate()) {
linccer.setEnvironmentCoordinates(longitude, latitude, accuracy);
}With Linncer you can define some environmental variables as bssids, selected_clients, client_name. Just make use of three methodes to redefine the updateEnvironment method.
linccer.setName(_client_name);
linccer.setBssids(_bssids);
linccer.setClients(_selected_clients);Currently Linccer supports received, sent, error, updated_environment, ready, peek, deleteClient.
The ready event is fired when the Linccer has registered itself with the server (sent the first
environment update).
linccer.on('ready', function() { });linccer.on('received', function(data) { });linccer.on('error', function() { });linccer.on('deletedClient', function() { });
When Linccer is ready, use the send and receive methods to exchange data between websites.
Both action need to be triggered simultaneously.
linccer.send('one-to-many', {user : 'robert'});
linccer.receive('ont-to-many');Sample Code
Demo http://hccr.ws/linccer (best viewed on two different devices)