PvP networking library, to be used on top of F.Lobby
in-game messenging
this property is like:
network.messenger.send('hello');
network.messenger.receiver = {
onmessage: function(mess) {}
};
Returns: number timer_id
synchronized frame
Each frame call is synchronized across the two peers, with facility provided to maintain two identical game worlds. If network condition permits, the target framerate will be maintained.
frame will be called with:
example:
function frame(time, data, send)
{
if( time===0) {
// start
} else {
// do something with data
}
//send synchronization data
send({..});
}
{server, param} (accquired from F.Lobby){on:function}report status events by calling monitor.on(event, data)
open
when connection opens
close
when connection closes
log, mess
logging information
error, mess
connection error
sync_error
network.js sync error
teardown
named data exchange. both sides have to call with same name.
example:
network.transfer(
'game_config',
function() { return {..} },
function(data) { apply(data) });