Search Unity

websocket-sharp doesn't work with IL2CPP

Discussion in 'Multiplayer' started by MohmadAlmasre, Sep 8, 2019.

  1. MohmadAlmasre

    MohmadAlmasre

    Joined:
    Jun 21, 2019
    Posts:
    9
    Hi everyone .
    i'm using websocket-sharp
    it's really great , easy to use but after Google Play Store told us that we must upload 64bit apps
    i tried to export APK but the compiler give me an error this time ..

    Assets\Scripts\NetWorkManager.cs(5,7): error CS0246: The type or namespace name 'WebSocketSharp' could not be found (are you missing a using directive or an assembly reference?)

    when i tried to go back to mono instead of IL2CPP it works fine .

    it stops after checking NDK !!!
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    What is WebSocketSharp? I don't think that is part of the .NET Class Library code. Is it a separate library used in this Unity project?
     
    MohmadAlmasre likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
  4. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    270
    Make sure you preserve all symbols from the library.

    Code (CSharp):
    1. <linker>
    2.     <assembly fullname="WebSocketSharp">
    3.         <type fullname="WebSocketSharp*" preserve="all"/>
    4.     </assembly>
    5. </linker>
    Also, like I posted elsewhere, you can try my working fork.

    https://www.dropbox.com/s/kctbyddbnekdfpz/websocket-sharp.zip?dl=0

    There's something basic wrong with what you're doing though. You didn't reference the assembly correctly.
     
    MohmadAlmasre likes this.
  5. endeld

    endeld

    Joined:
    Oct 20, 2017
    Posts:
    6
    I've made open-source a WebSocket client that doesn't need an external DLL/WebSocketSharp here: https://github.com/endel/NativeWebSocket

    It doesn't implement a WebSocket Server though. Just the client.
     
  6. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    270
    MohmadAlmasre and endeld like this.
  7. MohmadAlmasre

    MohmadAlmasre

    Joined:
    Jun 21, 2019
    Posts:
    9
    thanks all i used System.Net.websockets instead and it works fine