Hi, I am new to fuse. I am developing an app that tracks user locations using node and socket.io
It tracks location of the user and emits it to the server where the socket emits the location to all the subscribers and it will display the coordinates on the map. I am using the ‘startListening’ and ‘changed’ event of GeoLocation service. On each changed event the location is emitted to node server and from their it is emitted to all corresponding listeners.
What i need to test is the on “changed” event of GeoLocation service.
Is there any way i can mock a location “changed” event on simulators. Or any idea how that would be developed.
Thanks in advance.
here’s my code snippet;
GeoLocation.on("changed", function (location) {
location.user_id = userDetails.id;
console.log("changed event started: ", JSON.stringify(location));
socket.emit('trackme', location);
})
function bikerClicked() {
var timeoutMs = 5000;
GeoLocation.getLocation(timeoutMs).then(function (location) {
console.log("geo location reached: =======", location)
location.user_id = 'some_user_id';
socket.emit('trackme', location)
}).catch(function (fail) {
console.log("getLocation fail " + fail);
});
var intervalMs = 1000;
var desiredAccuracyInMeters = 10;
GeoLocation.startListening(intervalMs, desiredAccuracyInMeters);
}