sta / sta/websocket-sharp

Current master doesn't build for Unity web player

Open
#52 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

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.

Assets/Plugins/websocket-sharp/Ext.cs(85,81): error CS1729: The type `System.IO.Compression.DeflateStream' does not contain a constructor that takes `3' arguments

I removed the 3rd argument, also on line 119

Assets/Plugins/websocket-sharp/Net/EndPointListener.cs(172,16): error CS0200: Property or indexer `System.Security.Cryptography.X509Certificates.X509Certificate2.PrivateKey' cannot be assigned to (it is read only)
Assets/Plugins/websocket-sharp/Net/HttpConnection.cs(96,19): error CS1061: Type `WebSocketSharp.Net.Security.SslStream' does not contain a definition for `AuthenticateAsServer' and no extension method `AuthenticateAsServer' of type `WebSocketSharp.Net.Security.SslStream' could be found (are you missing a using directive or an assembly reference?)
Assets/Plugins/websocket-sharp/Net/HttpListenerRequest.cs(242,37): error CS1061: Type `System.Security.Principal.IPrincipal' does not contain a definition for `Identity' and no extension method `Identity' of type `System.Security.Principal.IPrincipal' could be found (are you missing a using directive or an assembly reference?)
Assets/Plugins/websocket-sharp/Net/ListenerAsyncResult.cs(136,22): error CS0117: `System.Threading.ThreadPool' does not contain a definition for `UnsafeQueueUserWorkItem'

This I modified as per https://github.com/kaistseo/UnitySocketIO-WebSocketSharp

Assets/Plugins/websocket-sharp/Net/WebSockets/TcpListenerWebSocketContext.cs(134,39): error CS1061: Type `System.Security.Principal.IPrincipal' does not contain a definition for `Identity' and no extension method `Identity' of type `System.Security.Principal.IPrincipal' could be found (are you missing a using directive or an assembly reference?)
Assets/Plugins/websocket-sharp/Server/HttpServer.cs(676,21): error CS0117: `System.IO.File' does not contain a definition for `ReadAllBytes'
Assets/Plugins/websocket-sharp/WebSocket.cs(1897,33): error CS1061: Type `System.IO.FileInfo' does not contain a definition for `OpenRead' and no extension method `OpenRead' of type `System.IO.FileInfo' could be found (are you missing a using directive or an assembly reference?)
Assets/Plugins/websocket-sharp/WebSocket.cs(1982,38): error CS1061: Type `System.IO.FileInfo' does not contain a definition for `OpenRead' and no extension method `OpenRead' of type `System.IO.FileInfo' could be found (are you missing a using directive or an assembly reference?)
Assets/Plugins/websocket-sharp/WebSocketStream.cs(242,19): error CS1061: Type `WebSocketSharp.Net.Security.SslStream' does not contain a definition for `AuthenticateAsServer' and no extension method `AuthenticateAsServer' of type `WebSocketSharp.Net.Security.SslStream' could be found (are you missing a using directive or an assembly reference?)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Unity Web Player build and reviewing the listed errors in Assets/Plugins/websocket-sharp, especially Ext.cs, Net/EndPointListener.cs, Net/HttpConnection.cs, and the related listener, server, WebSocket, and WebSocketStream files. Compare the available Unity APIs with the failing calls and determine safe compatibility changes rather than simply commenting out code. Done means the library builds for the Unity Web Player without these errors and the affected functionality remains appropriate for that target.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
build-system, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.