@mm8: Well the answer is that you cannot open websocket from controller using signalR(it opens by itself on startup hub configuration). And there for can’t use it as they want in task. I think what I have done with hub is after all the correct way. And just to return session data I used SignalR.Client nugget like this:

[HttpGet("match/join", Name = "JoinMatch")]
        public async Task<IActionResult> JoinMatch()
        {  
            var connection = new HubConnectionBuilder()
                .WithUrl("http://localhost:5000/match/room")
                .Build();

            await connection.StartAsync();
            await connection.SendAsync("Fire");

            return Ok(connection);
        }

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top