I have a Game Server using an ASPNet Core SignalR hub (GameServer), and a client using the ASPNet Core SignalR Client library (GameClient). I have successfully managed to create a connection between the two and pass some messages around.
There is also a class library in the middle to abstract out some things that will both be used by the server and the client (GameInteraction). GameInteraction is a .Net Standard library (I'm using Unity3d for the client, so the library needs to be in .Net Standard).
In GameInteraction, I have added some extension methods for Microsoft.AspNetCore.SignalR.Client.HubConnection as follows. I'm using these methods in the GameClient to be able to call some GameServer functions, without having to make sure the client knows which methods to invoke.
public static async Task<string> CreateGame(this HubConnection connection)
{
var gameId = await connection.InvokeAsync<string>(nameof(IServer.CreateGame));
return gameId;
}
public static async Task JoinGame(this HubConnection connection, string playerName, string gameId)
{
await connection.InvokeAsync(nameof(IServer.JoinGame), playerName, gameId);
}
Now, whenever GameClient tries to establish a connection to the server, I get the following error.
Microsoft.AspNetCore.Server.Kestrel[0]
The connection listener failed to accept any new connections.
System.MissingMethodException: Method not found: 'Microsoft.AspNetCore.Http.Features.IFeatureCollection Microsoft.AspNetCore.Connections.ConnectionContext.get_Features()'.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.KestrelConnection..ctor(Int64 id, ServiceContext serviceContext, ConnectionDelegate connectionDelegate, ConnectionContext connectionContext, IKestrelTrace logger)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.ConnectionDispatcher.<>c__DisplayClass8_0.<<StartAcceptingConnectionsCore>g__AcceptConnectionsAsync|0>d.MoveNext()
I have a feeling this is because of some mismatch between the SignalR libraries I'm using, even though I'm using the ASPNet Core version for all three projects. Please note that if I remove the extension methods, but don't remove the SignalR.Client library from GameInteraction, the connection STILL cannot be established. It's only once I remove the library completely from GameInteraction that things work again.
Can someone please nudge me towards a solution? Thanks in advance.