简体   繁体   English

如何“超载” WebSocket?

[英]How do I “overload” websocket?

In the instructions on this page: 在此页面的说明中:

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

It states: in your javascript, create a new WebSocket, and overload its method 'onmessage', 'onopen', 'onerror', 'onclick'; 它指出:在您的JavaScript中,创建一个新的WebSocket,并重载其方法“ onmessage”,“ onopen”,“ onerror”,“ onclick”;

What does this mean?.. 这是什么意思?..

If you look at their javascript file, you can see they set: 如果查看他们的javascript文件,则可以看到它们的设置:

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

You should set those to be implementations you want to be called. 您应该将那些设置为要调用的实现。 Eg 例如

their_object.onopen = function (openObject) {
   // Your code here.
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM