Skip to content
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

Unity - [WebGL] SOCKET_REF_MAP.has is not a function #138

Closed
supernimbus-daithi opened this issue Aug 30, 2022 · 2 comments · Fixed by #142
Closed

Unity - [WebGL] SOCKET_REF_MAP.has is not a function #138

supernimbus-daithi opened this issue Aug 30, 2022 · 2 comments · Fixed by #142
Labels

Comments

@supernimbus-daithi
Copy link

supernimbus-daithi commented Aug 30, 2022

Unity version: 2019.3.15f1

Nakama SDK version: v3.4.1

On WebGL platform, calling socket.CloseAsync() after invalid credentials auth results in a Web Player crash.

Example code:

{
        try
        {
            _session = await _client.AuthenticateEmailAsync("test@email.net", "password");
        }
        catch (ApiResponseException ex)
        {
            Debug.LogError(ex.Message);
        }
        catch (Exception ex)
        {
            Debug.LogError(ex.Message);
        } 

        await _socket.CloseAsync();
}

Stack trace example:

UnityLoader.js:4 exception thrown: TypeError: SOCKET_REF_MAP.has is not a function, 
TypeError: SOCKET_REF_MAP.has is not a function
    at _NKCloseSocket (blob:http://127.0.0.1:8887/f135b843-a35c-4058-a023-ec1dbad5f828:8:59792)

image

@lugehorsam lugehorsam changed the title [WebGL] SOCKET_REF_MAP.has is not a function Unity - [WebGL] SOCKET_REF_MAP.has is not a function Sep 21, 2022
@lugehorsam
Copy link
Contributor

Hey @supernimbus-daithi we've submitted a PR to fix this. Please note that you also need to connect the socket before closing it.

@lugehorsam
Copy link
Contributor

@supernimbus-daithi we've resolved this issue and it will be included in the next release. If you would like to include the fix in your project now you can point your .upm file to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants