SignalR websockets only working on first request Google Cloud Compute Engine

We are using SignalR to see if there is a POST-request incoming. If there is a POST-request, we want to display it's content live in the HTML.

In localhost this works 100% perfectly! But when we deploy our application to Google Cloud Compute Engine we have the problem that the websocket only works live once. After that we need to refresh our page, when we refresh the sent data comes through but we want to have it live.

Maybe also important: We are using a (HTTPS) load-balancer.

We tried to use Sticky Sessions in Google Cloud like this

--timeout=3600 --affinity-cookie-ttl=3600 --session-affinity=GENERATED_COOKIE

but without result.

Personally we think the problem exists in Google Cloud somewhere, because it works perfectly on the localhost! Is there maybe some kind of setting we need to enable in Google Cloud Compute Engine to keep websockets live? Now it only works once.

This is our code, however, this code works perfectly on localhost. We really think we have misconfigured or are missing some kind of setting in our Google Cloud...

Server-side socket:

public async Task<IActionResult> Index([FromBody] DtoInzending dtoInzending)
            var inzending = new Inzending
                OpdrachtFk = dtoInzending.OpdrachtFk,
                FotoPath = dtoInzending.FotoPath,
                Locatie = dtoInzending.Locatie,
            dtoInzending.VraagAntwoorden.ForEach(antwoord =>
                inzending.VraagAntwoorden.Add(new VraagAntwoord
                    Antwoord = antwoord.Antwoord,
                    VraagFk = antwoord.VraagFk,
            var addedInzending = _inzendingManager.GetAll()
                .Include(i => i.VraagAntwoorden)
                .ThenInclude(i => i.Vraag)
                .FirstOrDefault(i => i.Id == inzending.Id);
            await _signalRHubContext.Clients.All.SendAsync(
                HttpContext.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value,
            var response = new ApiResponse<DtoInzending>
                Result = inzending.ToDto(),
                Status = StatusCodes.Status200OK
            return Ok(response);

Client-side socket (partly):

 constructor() {
        this.#connection = (new signalR.HubConnectionBuilder())


Client-side socket (most important parts):

#connection async #subscriber() {

    await this.#connection.on("LoadInzendingen", async (user, message) => {
        await this.#newCard(message)
            title: 'Nieuwe opdracht!',
            message: 'Er werd een nieuwe opdracht opgestuurd, scroll naar beneden!'

This is for a school project we need to demo tomorrow. So we would really love you if you were able to provide us with a solution!