问题
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