[appengine-java] Re: Channel API reconnect after token timeout

2012-01-06 Thread Joseph McMullin
Hey,  
I am also experiencing this problem. 
Trying to reconnect from the client side after the token expiries with no luck.
I'm using the gwt-gae-channel library on client side.
I was just wondering if you have found a solution to this problem? 
Thanks
Joe

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Channel API reconnect after token timeout

2012-01-06 Thread Daniel Florey
I've received a reasonable workaround from Google Enterprise Support:
You can use a timer on the client side to renew the token before it 
expires. This will work somehow...

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/NivXiDrqW7QJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Channel API reconnect after token timeout

2012-01-06 Thread Joe McMullin


Hey,
I am also experiencing this problem. Trying to reconnect from the client 
side 
after the token expiries with no luck, I'm using the gwt-gae-channel 
library on 
client side.
I was just wondering if you have found a solution to this problem? 

Thanks 
Joe

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/qwj6druVlUsJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Channel API reconnect after token timeout

2011-12-05 Thread gbs63
Hi there,

(First I'm french... so please apologize for my english mistakes)

I'm working with GAE, using python, and get the same problem as you, to 
refresh tokens for users allready connected

just to say... I've started a chat-script, by using a login script, with 
session in python:

from gaesessions import get_current_session


 for example, calling the session using :

def Guestbook(message, tokens=None):
 if not tokens:
 tokens = memcache.get('tokens')
 if tokens:
 session = get_current_session()
 user=session.get('user_name')


But each time I restarted the server, the user wasn't automatically 
reconnected... which is quite the same problem as yours 

here is my issue, from client-side :

!DOCTYPE html
 html
 head
 meta charset=utf-8/
 titleGAE Test-Channel-API/title
 style type=text/css
 #userlist {
 margin: 5px 0 0 0;
 padding: 5px;
 border: 1px solid #ccc;
 height: 320px;
 overflow: auto;
 font-size:12px;
 }
 /style
 script src=/_ah/channel/jsapi/script
 script src=/jquery.js/script
 script
 reco_count=0;
 $(document).ready(
 function() {
 var token;
 function get_token() {
 if (token) {return false;} ;// try to prevent duplicate entry 
 $.get('/get_token', function(data){
 if (data) {
 reco_count=0;
 token = data;
 document.getElementById('userlist').innerHTML=token +  connected!br
 openChannel();
 }
 else
 {
 document.getElementById('userlist').innerHTML=document.getElementById('userlist').innerHTML+Can't
  
 connect... Channel Full ? !br;
 }
 });
 setTimeout(function() {if (!token) {Reconnect();} },4000 ); // retry to 
 connect
 }
 get_token();

 function Reconnect() {
 setTimeout(function() {if (token) {reco_count=0; return false;} else 
 {reco_count=reco_count+1; 
 document.getElementById('userlist').innerHTML=Server error !brTrying to 
 reconnect (+reco_count+)... fail br;  get_token(); }; }, 4000);
 }
 function onClose() {
 token=null;
 Reconnect();
 }
 function onError() {
 token=null;
 Reconnect();
 }
 function onOpen() {
 $.post('/open', {'token': token});
 }
 function onMessage(m) {
 // getting message
 // TODO
 }
 function openChannel() {
 var channel = new goog.appengine.Channel(token);
 var handler = {
 'onopen': onOpen,
 'onmessage': onMessage,
 'onerror': onError,
 'onclose': onClose 
 };
 channel.open(handler);
 }
 $(window).bind('beforeunload', function() {
 if (token) {
 document.getElementById('userlist').innerHTML=document.getElementById('userlist').innerHTML+token
  
 +  disconnected!br
 $.post('/del_token', {'token': token});
 }
 })
 }
 )
 /script
 /head
 body
 div id=userlist style=position:relative;top:0px;left:0px;/div
 /body/html


Hoping it will help some,

Rgds,

guibs





-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/cqdUw6HMleYJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Channel API reconnect after token timeout

2011-11-14 Thread Daniel Florey
...finally figured out how to properly remove the iframe from a GWT app:

public static native void removeChannelApi() /*-{
  var child = $wnd.parent.document.getElementById(wcs-iframe);
  if ( child != null ) {
   child.parentNode.removeChild(child);
  }
}-*/;

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/sg_sPX024w8J.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.