Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Disconnect from server (Unet, WebGL).

Discussion in 'Connected Games' started by AlekseyKhomenko, Jan 12, 2017.

  1. AlekseyKhomenko

    AlekseyKhomenko

    Joined:
    Feb 17, 2016
    Posts:
    7
    When I call client.Disconnect() on WebGL I get error: UNETWebSocketsInstances.hostsContainingMessages is null. On iOS and Android all works fine. Can anybody help me?
    upload_2017-1-12_15-48-32.png
     
  2. AlekseyKhomenko

    AlekseyKhomenko

    Joined:
    Feb 17, 2016
    Posts:
    7
  3. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @AlekseyKhomenko Hi Aleksey
    Could you please open bug for this, submit them (with project and reproducing steps) and ping me with private message? If you will be able to do it before monday i will take a look on the next week

    i'm sorry for this :(
     
  4. infuzo

    infuzo

    Joined:
    Aug 22, 2013
    Posts:
    44
    So, for "fix" it:
    1. Go to your compiled progect, Release or Development folder.
    2. Find file named as your_project_name.js in any text editor. If you have Release build, unpack file your_project_name.jsgz
    3. Find fragment
    Code (JavaScript):
    1. if (UNETWebSocketsInstances.hostsContainingMessages[i].id == hostId) UNETWebSocketsInstances.hostsContainingMessages[i] = null;
    4. Replace this fragment on
    Code (JavaScript):
    1. if(UNETWebSocketsInstances.hostsContainingMessages[i] != null) {
    2. if (UNETWebSocketsInstances.hostsContainingMessages[i].id == hostId) UNETWebSocketsInstances.hostsContainingMessages[i] = null;
    3. }
    5. Save. If you have Release, replace this file in source archive.
    6. "Enjoy" your raw UNET.
    7. PROFIT???
     
    Last edited: Jan 17, 2017
  5. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    regardless of whether this is the proper fix, I just want to point out that you can make that change to the source <install folder>/PlaybackEngines/WebGLSupport/BuildTools/lib/UnetWebSocket.js

    so that you don't need to decompress, modify, compress everytime after you build.
     
  6. infuzo

    infuzo

    Joined:
    Aug 22, 2013
    Posts:
    44
    Thank!
     
  7. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    418
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    I personally haven't investigated the problem, I don't know if the recommended fix has any side effect.

    That bug was fixed a while ago. I suspect you are experiencing a different bug with same symptoms. A bug report would be appreciated.
     
  9. DimensionU

    DimensionU

    Joined:
    Aug 1, 2013
    Posts:
    43
    Did anyone ever create a ticket for this like @aabramychev requested? We just upgraded to 5.6 and are having to apply @infuzo's workaround to address it.
     
  10. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    @DimensionU could you open it? it is not problem if we will have duplicate, in the description of the bug (with repro steps) could you add ref to this topic?

    thanks a lot
    Alex
     
  11. davood3152

    davood3152

    Joined:
    Mar 8, 2018
    Posts:
    1
    Hi Check this out : in networkmanager component "Use WebSockets" is Ticked ?
     
  12. Sheezuu

    Sheezuu

    Joined:
    Oct 24, 2018
    Posts:
    8
    am getting this issue on executing webgl html page "Uncaught TypeError: Cannot read property ‘id’ of null "
    plz help me to solve this