Closed michaelwuwar closed 1 month ago
Older versions of the addEventListener() solution will fail to call this api properly in some environments. Changing to webSocket.onopen, webSocket.onclose, webSocket.onmessage, webSocket.onerror It does not affect the original browser operation, and enhances additional support for environments such as applets.
Can you give more details on when this fails? both addEventListener
and onevent
are in the JavaScript spec for websocket so either should work
Older versions of the addEventListener() solution will fail to call this api properly in some environments. Changing to webSocket.onopen, webSocket.onclose, webSocket.onmessage, webSocket.onerror It does not affect the original browser operation, and enhances additional support for environments such as applets.
Can you give more details on when this fails? both
addEventListener
andonevent
are in the JavaScript spec for websocket so either should work
This operating environment is probably relatively rare. Currently unity in China supports wechat applets, an environment that runs programs within wechat, a mobile software Wechat applets support unity by providing a simulation of a web environment, but that environment is different from traditional web environments in that it doesn't support addEventListener. Very soon, there will be many unity developers for the Chinese market may also run into similar problems as mine, and I'd like to replace it with onevent to provide support for WeChat.
tested the changes here https://github.com/James-Frowen/SimpleWebTransport/commit/a342e9f5ff4ccd4323af6da812cffc38f744edbd
seems to work fine, should be good to merge
Older versions of the addEventListener() solution will fail to call this api properly in some environments. Changing to webSocket.onopen, webSocket.onclose, webSocket.onmessage, webSocket.onerror It does not affect the original browser operation, and enhances additional support for environments such as applets.