📅  最后修改于: 2022-03-11 15:04:32.110000             🧑  作者: Mango
var gps = require("gps-tracking"); var options = { 'debug' : true, 'port' : 8090, 'device_adapter' : "TK103"} var server = gps.server(options,function(device,connection){ device.on("login_request",function(device_id,msg_parts){ // Some devices sends a login request before transmitting their position // Do some stuff before authenticate the device... // Accept the login request. You can set false to reject the device. this.login_authorized(true); }); //PING -> When the gps sends their position device.on("ping",function(data){ //After the ping is received, but before the data is saved //console.log(data); return data; }); });