-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Current master doesn't build for Unity web player #52
Comments
I strongly suggest to build websocket-sharp.dll with MonoDevelop, and use it in Unity. |
@sta @ssfrr Hi guys, i've started using websocket-sharp and am very pleased with it! Thanks! I have a small issue with the library for the webplayer. Although when i use the webplayer in the editor, everything works fine, when i build for the actual webplayer, i get a plain error (in the console) saying "Error getting handsake from Socket.IO host instance: An error occurred performing a WebClient request.". No more details. Currently i'm using the .dll but from what i've heard, .dlls are not compatible with the web player. Could this be the issue? and fyi how can i safely adapt the c# code for my game? |
@ssfrr have you mannaged to get the webplayer working in the browser? |
On @sta's advice I built it in MonoDevelop into a DLL and included the DLL in my Assets folder, and it worked like a charm in both the web and desktop players. I also thought you couldn't use DLLs in web-player, but I think as long as the DLL is purely managed code (AFAIK basically it just can't call out to native libraries) then it seems to work fine. Note that the fix in #51 is necessary if you want it to work properly on OSX. |
How did you use websocket-sharp at that time? Copied code or DLL built yourself? |
@sta copied the dll :) is that not ok? i've built the project and used the resulting dll. I haven't included the fix from #51 but it should still work i think. Note that on top, i'm using socket.io (https://github.com/kaistseo/UnitySocketIO-WebSocketSharp) |
I think, perhaps, those .dlls mean unmanaged (native) dlls (, and requires Unity Pro). websocket-sharp.dll is managed (.NET assembly) dll, so it doesn't apply to the above .dlls.
Have you gotten same error still? |
@sta yes, still. I have Unity Pro 4.5. I get this error for the requestHandshake. On further debugging (placing while(exception!=null) { Debug.Log("ex: "+ex.Message); e = e.InnerException; } i also get: socket client error: SocketIO.Cent.Connect threw an exception and in the Connect() method: socket client error: Object reference not set to an instance of an object |
@badescuga did you find a fix for this ? I am exactly in the same situation. Everything is working fine in the editor (in webplayer mode, with socket policies settled, etc.) but in chrome or firefox I got the same error: Handshake error stacktrace at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in :0 at System.Net.WebClient.m__E (System.Object state) [0x00000] in :0 Seems to come from this : byte [] DownloadDataCore (Uri address, object userToken)
|
Just export for webgl, problem solved. |
There are some tweaks I had to make in order to get the library to build for the Unity Web Player. I'm not 100% sure how safe the changes are. Most of the issues are API calls that aren't present in the System libraries that the web player gets built with. I'm not using compression or encryption so mostly I just commented out the offending lines to satisfy the compiler.
I removed the 3rd argument, also on line 119
This I modified as per https://github.com/kaistseo/UnitySocketIO-WebSocketSharp
The text was updated successfully, but these errors were encountered: