1

I am using Google Drive's Realtime API in a javascript app to collaborate on a series of mouse points. On a timer I am setting the complete list of mouse points as a value in a CollaborativeMap. As the mouse moves the list of points grows and the set call is pushing more data into the map.

After 25 set calls spread over 1 minute I am assigning a large chunk of data (roughly 325000 characters) with each call.

At this point in the process I see the following in the console:

Resource interpreted as Image but transferred with MIME type text/plain:
"https://drive.google.com/otservice/bind?id=...&sid=...&VER=8
 &access_token=...&lsq=...&SID=...
 &RID=513&TYPE=terminate&zx=...". api:87

Gfapi:87
fgapi:111
yhapi:145
uh.Yapi:143
Gc.handleEventapi:28
Edapi:47
Papi:44
Weapi:82
lf.Eaapi:81

After seeing this the Realtime api no longer functions. This does not seem to be an exception that the api is throwing or an error returned to an error handler.

I have not been able to find documentation that explains what this means or how to handle it.

As Mayra points out you can pass an error function to the load call and I am already doing so--as it is done in rtclient.RealtimeLoader.prototype.load in the realtime-client-utils.js sample code Google provides as part of the Quickstart documentation. My error function is called for some errors; however, it is not called for the error case this question is concerned with.

Can someone explain how to interpret the console output and how my application can detect the problem and handle it?

P.S. I know I can cut down the amount of data I am sending; however, I would like to develop a solution which can handle the error conditions which can occur.

JesseHenn
  • 73
  • 6

1 Answers1

1

To handle errors, you can add a error function to your load call: https://developers.google.com/drive/realtime/reference/gapi.drive.realtime#gapi.drive.realtime.load

This should get invoked when the realtime API encounters an error. Then you can take appropriate action, which may just be reloading the document.

As you guessed, to prevent the issue you should reduce the amount of data you are sending in a single change. Try to keep each individual change on the order of a a couple 100k.

Cheryl Simon
  • 46,552
  • 15
  • 93
  • 82
  • Unfortunately I already specified an error function that is being called for some errors; however, it is not getting called in the scenario I described. I have updated my question to clarify this details. – JesseHenn Apr 28 '13 at 03:14
  • Thanks for the details, we'll look into it. – Cheryl Simon Apr 30 '13 at 17:08
  • Note: If I use the [DocumentSaveStateChangedEvent](https://developers.google.com/drive/realtime/reference/gapi.drive.realtime.DocumentSaveStateChangedEvent) to throttle my updates by only making new modifications when all previous changes were saved I can greatly increase the amount of data I am able to send before seeing the error. – JesseHenn May 01 '13 at 21:57