0

在此页面上的说明中:

https://github.com/FreakDev/PhoneGap-Android-HTML5-WebSocket

它指出:在您的 javascript 中,创建一个新的 WebSocket,并重载其方法 'onmessage'、'onopen'、'onerror'、'onclick';

这是什么意思?..

4

1 回答 1

1

如果您查看他们的javascript文件,您可以看到他们设置:

// listener to overload
this.onopen = null;
this.onmessage = null;
this.onerror = null;
this.onclose = null;

您应该将它们设置为您想要调用的实现。例如

their_object.onopen = function (openObject) {
   // Your code here.
}
于 2013-01-31T17:59:54.837 回答