crash in some app using ios webview

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

acedreams
Posts: 5
Joined: 07 Nov 2015, 02:02

crash in some app using ios webview

Postby acedreams » 24 Jan 2016, 11:15

Hi ,Bax,
I met a problem that it always crashes in some app using ios webview +sfs html5.
after checking and testing, I found the problem lie in ios webview using low version html5 protocol,not process some exception using websocket.
how do i solve the problem.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: crash in some app using ios webview

Postby Lapo » 25 Jan 2016, 08:42

Hi,
I am not familiar with the details of the webview. You say that it uses a different version of the websocket protocol... what version is it?
Also what iOS and Safari versions are you testing on?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
acedreams
Posts: 5
Joined: 07 Nov 2015, 02:02

Re: crash in some app using ios webview

Postby acedreams » 25 Jan 2016, 14:56

sfs html5 is work on safrai, safrai use new version websocket v13, but some app integrate ios webview use websocket v7,
and i find some other html5 engine is work on websocket v7, these engine websocket use binaryType = "arraybuffer", even some have buff function.
so i guess maybe sfs html5 lack something to process exception when direct use json.
when will you issue the new version of html5 api? what are the new featrue ?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: crash in some app using ios webview

Postby Lapo » 25 Jan 2016, 16:02

It could be a problem with the old draft protocol version. Hybi-07 is quite old and is probably not supported by Netty (the websocket engine).
The specification itself states that:

Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time.


https://tools.ietf.org/html/draft-ietf- ... rotocol-07

Also you didn't specify which iOS/Safari versions you're using... for iOS the minimum version I believe is 8.1

when will you issue the new version of html5 api? what are the new featrue ?

We'll probably integrate the Jetty support for websocket and abandon Netty, although I can't guarantee this will provide backward compatibility with draft versions of the websocket protocol.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
acedreams
Posts: 5
Joined: 07 Nov 2015, 02:02

Re: crash in some app using ios webview

Postby acedreams » 26 Jan 2016, 00:48

thx,Lapo.
I find these crashes happens when websocket's onMessage() be called. i try to set delay time(0.1s) to handle these message,the crashes be reduced.

here,I past another html5 engin codes . these codes is work on websocket v7.maybe you will find something.



(function(a, b, c) {
function d(a) {
b.Transport.apply(this, arguments)
}
a.websocket = d;
b.util.inherit(d, b.Transport);
d.prototype.name = "websocket";
d.prototype.open = function() {
var a = b.util.query(this.socket.options.query),
d = this,
g;
g || (g = c.MozWebSocket || c.WebSocket);
this.websocket = new g(this.prepareUrl() + a);
this.websocket.onopen = function() {
d.onOpen();
d.socket.setBuffer(!1)
};
this.websocket.onmessage = function(a) {
d.onData(a.data)
};
this.websocket.onclose = function() {
d.onClose();
d.socket.setBuffer(!0)
};
this.websocket.onerror = function(a) {
d.onError(a)
};
return this
};
d.prototype.send = function(a) {
this.websocket.send(a);
return this
};
d.prototype.payload = function(a) {
for (var b = 0, c = a.length; b < c; b++) this.packet(a[b]);
return this
};
d.prototype.close = function() {
this.websocket.close();
return this
};
d.prototype.onError = function(a) {
this.socket.onError(a)
};
d.prototype.scheme = function() {
return this.socket.options.secure ? "wss" : "ws"
};
d.check = function() {
return "WebSocket" in c && !("__addTask" in WebSocket) || "MozWebSocket" in c
};
d.xdomainCheck = function() {
return !0
};
b.transports.push("websocket")
})("undefined" != typeof io ? io.Transport : module.exports, "undefined" != typeof io ? io : module.parent.exports, this);
(function(a, b) {
function c() {
b.Transport.websocket.apply(this, arguments)
}
a.flashsocket = c;
b.util.inherit(c, b.Transport.websocket);
c.prototype.name = "flashsocket";
c.prototype.open = function() {
var a = this,
c = arguments;
WebSocket.__addTask(function() {
b.Transport.websocket.prototype.open.apply(a, c)
});
return this
};
c.prototype.send = function() {
var a = this,
c = arguments;
WebSocket.__addTask(function() {
b.Transport.websocket.prototype.send.apply(a, c)
});
return this
};
c.prototype.close = function() {
WebSocket.__tasks.length = 0;
b.Transport.websocket.prototype.close.call(this);
return this
};
c.prototype.ready = function(a, e) {
function f() {
var b = a.options,
f = b["flash policy port"],
m = ["http" + (b.secure ? "s" : "") + ":/", b.host + ":" + b.port, b.resource, "static/flashsocket", "WebSocketMain" + (a.isXDomain() ? "Insecure" : "") + ".swf"];
c.loaded || ("undefined" === typeof WEB_SOCKET_SWF_LOCATION && (WEB_SOCKET_SWF_LOCATION = m.join("/")), 843 !== f && WebSocket.loadFlashPolicyFile("xmlsocket://" + b.host + ":" + f), WebSocket.__initialize(), c.loaded = !0);
e.call(g)
}
var g = this;
if (document.body) return f();
b.util.load(f)
};
c.check = function() {
return "undefined" != typeof WebSocket && "__initialize" in WebSocket && swfobject ? 10 <= swfobject.getFlashPlayerVersion().major : !1
};
c.xdomainCheck = function() {
return !0
};
"undefined" != typeof window && (WEB_SOCKET_DISABLE_AUTO_INITIALIZATION = !0);
b.transports.push("flashsocket")
})("undefined" != typeof io ? io.Transport : module.exports, "undefined" != typeof io ? io : module.parent.exports);
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: crash in some app using ios webview

Postby Lapo » 26 Jan 2016, 10:23

Honestly it would have helped more if you replied to the questions I asked twice, such as what version of iOS and Safari you're using.
I have done a quick test in XCode 7 and iOS9 and the webview component works just fine, so it seems you're probably working with an iOS version that is too old.

thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 15 guests