cloudfoundry-attic / cf-dotnet-sdk

Cloud Foundry .NET SDK
Other
18 stars 13 forks source link

SignalR + multiple instances #137

Open devindran opened 6 years ago

devindran commented 6 years ago

Creating an issue here but please advise if this should be moved elsewhere.

I am deploying an asp.net core application that uses SignalR and an Angular frontend that connects to the backend hub using wss.

When I deploy with 1 instance, everything works fine and my javascript is able to connect via websockets to the backend.

When I scale my application to 2 instances, there's a 50% chance that I will get the following error when I try to load my page:

WebSocket connection to 'wss://xxxxxxxx/dashboard?id=DQ-w4-C_BJn5dyyA9cgvxA' failed: Error during WebSocket handshake: Unexpected response code: 404

It will try to failover to ServerSentEvents and LongPolling and will also fail with the same message.

I have tried this with and without Redis scaleout (as a PCF service as well as external Redis cluster).

I've tried to include as much logs as possible but nothing is shown except the standard 404 response.

Using the following packages Microsoft.AspNetCore.SignalR 1.0.2 Microsoft.AspNetCore.SignalR.Redis 1.0.2

npm package @aspnet/signalr 1.0.2

The code is able to work correctly when deployed locally. Appreciate any help you can suggest.

farhanars commented 5 years ago

Do you manage to find a solution to this? Facing the same problem

iojancode commented 5 years ago

Same trouble here. I read SignalR needs session affinity, but i do not know how to config that in cloud fundry for dotnet

Coder3333 commented 5 years ago

I have a very similar issue. Did anyone solve this?

jamesradenz commented 3 years ago

Any word on this?

Same issue, .NET Core backend talking to react-native client.

Ive tried setting up the Redis service in the PCF space but with 4 instances it fails 75% of the time, single instance works fine