This requires a more complicated infrastructure / code
Possibility 1 : P2P GEOLOC TRANSMISSION
<script src="https://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.9/peer.min.js"></script>
// p2p broker should be hosted by poppy
// distinguish between boss & slave in the url (like for doodle)
// therefore, the url contains : a maphasp (+ a mapcode if boss)
// verify if boss : hash(code) = maphash
// code not guessable by slave
//
// problem : using maphash as peerid, a slave can impersonate the master
// issue bcz it would prevent the real master to access the data
// otherwize data might be shared, but with p2p, this would require a network with O(N²) links...
// -> problem : not scalable
var maphash = null
var mapcode = null
var peerjs_apikey = 'kjhlkjhlkjh'
// if i am a boss :
var peer = new Peer(maphash, {key: peerjs_apikey});
peer.on('connection', function(conn)
{
conn.on('open', function()
{
conn.on('data', function(data)
{
console.log('Received', data);
// put data on map (with indication of date/time)
// make it disappear after a while
});
});
});
// if i am a slave & I push on a button
function send_position()
{
var rand = Date.now() +''+ Math.random()
var peer = new Peer(maphash + rand, {key: peerjs_apikey});
var conn = peer.connect(maphash)
conn.on('open', function()
{
conn.send(JSON.stringify(current_coords));
peer.destroy()
});
}
$('#btn-send-position').on('click', send_position)
Possibility 2:
send data to server, using ajax
then the server reflects the data through SSE (the js would subscribe to the SSE events)
-> this needs :
a server with a listening script
a memcache to share the received data
a SSE script
server records in sqlite (low traffic, simple)
-> the customers are isolated through their mapid
Possibility 3:
Use Twilio Sync, PubNub, ... to synchronize state through all the members of a
-> requires payment / apikey -> administration ...
Possibility 4:
Using a decentralized internet solution
-> to explore
This requires a more complicated infrastructure / code
Possibility 1 : P2P GEOLOC TRANSMISSION
Possibility 2:
-> this needs :
a server with a listening script
a memcache to share the received data
a SSE script
server records in sqlite (low traffic, simple)
-> the customers are isolated through their mapid
Possibility 3:
Use Twilio Sync, PubNub, ... to synchronize state through all the members of a -> requires payment / apikey -> administration ...
Possibility 4:
Using a decentralized internet solution -> to explore