Channel API onError codes

123 views
Skip to first unread message

Andrin von Rechenberg

unread,
Dec 14, 2011, 4:58:04 AM12/14/11
to google-a...@googlegroups.com
Hey there

We are using the Channel API heavily with mobile devices.

Sometimes the onError JS Callback is called with error code 0.
We are assuming that this is because connection was lost.

If that happens, can we just call channel.open() again?
Would the Google Service ever return code 0?

At the moment our JS implementation is:

function onError(error) {
  if (error.code == 0) {
    // No need to get a new token.
    channel = new goog.appengine.Channel(channel_id);
    channel.open()
  } else {
    // Google doesnt like this token anymore
    requestNewChannelID();
  }
}

We would be really screwed if Google would ever return code 0.

What are possible error codes google would return?
We also see code -1 quite often?

Cheers,
-Andrin

Andrin von Rechenberg

unread,
Dec 16, 2011, 6:21:49 AM12/16/11
to google-a...@googlegroups.com
For those who are interested:

We did quite extensive testing on this and we figured out that
in the onError JS Callback of a socket you can just close
the current channel and reopen a new channel with the same
channel id if error code is "0" or "-1".
This means you can spare the expensive extra new channel opening
on the server side. This especially useful for mobile websites
that loose the connection a lot.

So far we only saw google return error code 400 or 401.
When the service is down we expect 5xx error codes.

It still would be cool if someone from Google could confirm.

Cheers,
-Andrin

c18

unread,
Dec 17, 2011, 9:43:20 AM12/17/11
to google-a...@googlegroups.com
does anyone know why it is that every time i try to go to "khanacademy.com" it gives me this error?

Error: Server Error

The server encountered an error and could not complete your request.

If the problem persists, please report your problem and mention this error message and the query that caused it.


Reply all
Reply to author
Forward
0 new messages