code: function sendMessage(ws, type, content) {
  	var message = JSON.stringify([type, content]);
  	if (ws.readyState !== ws.OPEN)
  		return console.log("readyState="+ws.readyState+' on peer '+ws.peer+', will not send '+message);
  	console.log("SENDING "+message+" to "+ws.peer);
  	if (typeof window !== 'undefined' && window && window.cordova) {
  		ws.send(message);
  	} else {
  		ws.send(message, function(err){
  			if (err)
  				ws.emit('error', 'From send: '+err);
  		});
  	}
  }
docs: general network functions