编程知识 cdmana.com

Why can webscoket be used without a defined method? What is the principle?

I don't understand this part because I read the code written by others.Isn't webscoket only four built-in methods, onopen, onmessage, onerror, and onclose.
Here this $openws.ws is an instance of webscoket.But I saw that there is no chat_receipt method in the code at all, so why can it still be used? The backend has the same method name. Does it mean that webscoket can directly call the method determined by the backend through the instance, so even if it is connected, and then the backend can automatically push to the foreground by doing operations in this method?

img


Instances are like this.There is no such method at all

img

版权声明
本文为[CSDN Q&A]所创,转载请带上原文链接,感谢
https://cdmana.com/2022/218/202207301624418037.html

Scroll to Top