1
votes

I'm using App engine Channel API with gwt-gae-channel library (v. 0.4) in GWT and i'm trying to test the recreation of a channel, after expiration (i.e. onError is called with code 401).
The test is:
- use GWT RPC method to create a channel (clientID= and expiration = 1 minute) and get the token needed: createTestChannel(useremail).
- call ChannelFactory.createChannel(token, new ChannelCreatedCallback() { ... }) and channel.open(new MySocketListener(){...})
- when onError(...) is called (channel expires) I try to call createTestChannel(useremail) again (to get a new token for the same clientID) and open a channel, but I always get onError() and onClose() called .
If I refresh the page or open a new tab with the same code, the first channel creation works ok, but after each channel expiration, I cannot recreate them. I also tried another clientID, but it wont work.

2

2 Answers

0
votes

You must create a new channel on the server and get the new token. From the docs :

Tokens expire in two hours. If a client remains connected to a channel for longer than two hours, the socket’s onerror() and onclose() callbacks are called. At this point the client can make an XHR request to the application to request a new token.

http://code.google.com/appengine/docs/java/channel/overview.html#Tokens_and_Security