Reputation: 61
I have a REST server for my game in asp.net core 3 MVC ...
The client is Unity3D.
I want to have some websockets stuff for a part of this server.
I've made websocket server before. I had a console app as a server and I was using websocket-sharp library for both client (unity3d) and server.
I tried to implement websocket sharp on my new server, but is seems that this library doesnt work on iis...
I have problems adding websocket to this new server.
The first result everyone will face after searching for this issue, is SignalR. It doesn't have a unity3d client. (Actually, there is a non-official port, but as the author says: it's not extensively tested)
There is pure websocket too. But I can't connect to the server at all. I'm using browser websocket client to test my server.
Also I've found some people who wrote some middleware stuff.
Non of them worked for me even after cloning their repos.
The only one that was kinda semi-worked, was this one.
Why "semi-worked"?
I can connect to the server after cloning his rep ( mvc sample ). I even changed the target to dotnetcore 3 and everything was alright.
But when I copy-paste his classes to another project targeting dotnetcore 3 ( and I did EnableEndpointRouting=false stuff), the client can't connect to the server...
Can anyone help me with this?
Am I missing any configuration things?
Upvotes: 0
Views: 823
Reputation: 3073
Use Kestrel instead of IIS.
If you really want to author a C# server, you should familiarize yourself with how to start a server completely programmatically.
You can view a working two player networked example of SignalR server and client running in the Unity client here. You do not need to modify any source to make AspNetCore SignalR work in Unity. This runs great on my macOS editor.
Use the built-in C# websocket server classes otherwise.
Upvotes: 1