Skip to content

WeChat adaptation #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

liangpei-web
Copy link

No description provided.

@endel
Copy link
Member

endel commented May 30, 2025

Hi @liangpei-web, sorry for the delay to review your PR.

I don't feel comfortable maintaining a custom URL implementation inside the SDK just to support WeChat. I'd recommend using a global URL polyfill instead, like this one: https://www.npmjs.com/package/url-polyfill

Regarding the Uint8Array limitation, you should be able to monkey-patch the global WebSocket in your side to support it, like this:

const WebSocket_send = WebSocket.prototype.send;
WebSocket.prototype.send = function(data) {
    if (data instanceof Uint8Array) {
        WebSocket_send.call(this, data.slice().buffer);
    } else if (Array.isArray(data)){
        WebSocket_send.call(this, (new Uint8Array(data)).buffer);
    } else {
        WebSocket_send.call(this, data);
    }
}

@endel endel mentioned this pull request May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants