Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Data error in messaging

ANSWERED

I am trying to pass a the result of a web query from the companion to the watch, but I get this error:

Uncaught (in promise) RangeError: Encoded data too large: 1130 bytes

 

I am trying to get 2 different info from the Json. For now I need the station name and the extremes. It works if I do extremes only, but I get the error if I try to pass all the data.

Any suggestions? 

 

This is the code

 

 

 function queryOpenTide() {
console.log(ENDPOINT)
fetch(ENDPOINT)
.then(function (response) { response.json() .then(function(data) { returnTideData(data); });

 

 

 

This is a sample of the data:

 

{"status":200,"callCount":1,"copyright":"Tidal data retrieved from www.worldtide.info. Copyright (c) 2014-2017 Brainware LLC. Licensed for use of individual spatial coordinates on behalf of\/by an end-user. Source data created by the Center for Operational Oceanographic Products and Services (CO-OPS) and is not subject to copyright protection. NO GUARANTEES ARE MADE ABOUT THE CORRECTNESS OF THIS DATA. You may not use it if anyone or anything could come to harm as a result of using it (e.g. for navigational purposes).","requestLat":33.9875776,"requestLon":-118.4642124,"responseLat":34.0069,"responseLon":-118.499,"atlas":"NOAA","station":"Santa Monica","extremes":[{"dt":1509790852,"date":"2017-11-04T10:20+0000","height":-0.531,"type":"Low"},{"dt":1509813168,"date":"2017-11-04T16:32+0000","height":1.13,"type":"High"},{"dt":1509837596,"date":"2017-11-04T23:19+0000","height":-1.073,"type":"Low"},{"dt":1509860115,"date":"2017-11-05T05:35+0000","height":0.575,"type":"High"},{"dt":1509879442,"date":"2017-11-05T10:57+0000","height":-0.434,"type":"Low"},{"dt":1509901777,"date":"2017-11-05T17:09+0000","height":1.16,"type":"High"},{"dt":1509926887,"date":"2017-11-06T00:08+0000","height":-1.116,"type":"Low"},{"dt":1509949786,"date":"2017-11-06T06:29+0000","height":0.491,"type":"High"}]}

 

It works if I only use some part of the data (extremes).

 

 .then(function (response) {
      response.json()
      .then(function(data) {   
        var extremes = data.extremes;
        returnTideData(extremes);       
      });

 

 

 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

It looks like you're exceeding the maximum message size. You have two options:

 

1. Buffer the data, as per https://dev.fitbit.com/guides/communications/messaging/#maximum-message-size

 

2. Use the File Transfer API - https://dev.fitbit.com/guides/communications/file-transfer/

View best answer in original post

Best Answer
2 REPLIES 2

It looks like you're exceeding the maximum message size. You have two options:

 

1. Buffer the data, as per https://dev.fitbit.com/guides/communications/messaging/#maximum-message-size

 

2. Use the File Transfer API - https://dev.fitbit.com/guides/communications/file-transfer/

Best Answer

I am going to try with the file transfer API.

I am having connection issues with the device/companion after a while. That should solve it. 

Thanks for your help. I wish I could come meet you at the developer meetup, but I am stuck in LA for now.

Best Answer