The following example initializes vast.js to a plain Node.JS
HTTP server listening on port 3000.
varserver=require('http').Server();varvast=require('vast.js')(server);vast.on('connection',function(socket){// to perform a spatial publicationsocket.publish({name: John},{center: [35,45],radius: 100});// to subscribe a radiussocket.subscribe({center: [50,33],radius: 100},function(node){// move subscribed area to another center pointnode.move({center: [55,33]});});// receive subscribed messagessocket.on('message',function(data){});// receive enter / leave messagessocket.on('enter',function(node){});socket.on('leave',function(node){});// process disconnection from networksocket.on('disconnect',function(){});});server.listen(3000);varvast=require('vast.js')();vast.on('connection',function(socket){});vast.listen(3000);GPLv3