GAE Channel API : connection doesn't open on Android browser

依然范特西╮ 提交于 2019-12-13 06:41:25

问题


I'm testing Channel API in a basic test project. When Using chrome on desktop, the connection opens (an alert window appears) But when using android browser, the connection doesn't open, nothing happens. Actually, it has worked two or three times, but just the connection; and now, nothing. Below the code.

<html>
<head>
<script src='/_ah/channel/jsapi'></script>
</head>
<body>
<script type="text/javascript">
 initialize = function() {
    var chat_token = '<%=request.getParameter("token")%>';
    var channel = new goog.appengine.Channel(chat_token);
    var handler = {
          'onopen': onOpened,
          'onmessage': onMessage,
          'onerror': onError,
          'onclose': onClose
        };
    var socket = channel.open(handler);
    socket.onopen = onOpened;
    socket.onmessage = onMessage;
    socket.onerror = onError;
    socket.onclose = onClose;

 }
 onOpened = function() {
    alert('open');
 }

 onMessage = function(m){
        alert('message');
  };
  onError =  function(err){
  console.log('erreur');
        alert("Error => "+err.description);
    };
  onClose =  function(){
        alert("channel closed");
    };
    setTimeout(initialize, 100);
</script>
</body>
</html>

It's wird that it works on chrome, but not on android browser. Thanks for your help

来源:https://stackoverflow.com/questions/7522181/gae-channel-api-connection-doesnt-open-on-android-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!