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.
Asked
Active
Viewed 322 times
1

Andrei F
- 4,205
- 9
- 35
- 66
2 Answers
0
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

koma
- 6,486
- 2
- 27
- 53
-
When the channel is closed I call the same rpc method createTestChannel(username), witch creates a channel and returns a token. But after I receive the new token I get onError() and onClose() called when I try to open the channel (and no exception on the server side is thrown). – Andrei F Mar 06 '12 at 14:04
-
Weird. I have to rest my case. – koma Mar 06 '12 at 14:49
-
I have the same problem. Also with the gwt-gae-channel library. I recreate the token and get onError() and onClose() callbacks. – Dominik Mar 17 '12 at 21:53
0
This is a known issue:

dflorey
- 1,828
- 3
- 19
- 31
-
I only tested this localhost, maybe I should try to test this on production server also... – Andrei F Mar 06 '12 at 14:55