11-06-2018 16:32 - edited 11-06-2018 16:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-06-2018 16:32 - edited 11-06-2018 16:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello, im creating an app that is using the file transfer for json information from a 3rd part server.
This information only needs to be updated once a week. So im using wakeInterval and sit it to 4 days.
Now my only problem is getting the file onto the watch the first time the app is installed. What is the cleanest way of doing that?
right now i have a try to catch the readFileSync exception reached on error, which i then tried to fire a peer message to the device, but there seems to be a timing issue, because i keep getting an exception.(seems the port is not open yet). So i have to just keep doing a setInterval until the peer socket is open? below is what im using wonder if there is a cleaner way.
var timer = setInterval(function(){
if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {
messaging.peerSocket.send({"command":"getGames", "week":"4"});
clearInterval(timer);
}
},4000)

11-08-2018 11:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-08-2018 11:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
thank you for sharing!!

