Fix Room List Not Updating On Clients Dynamically
Fix ``ChatHub`` Namespace
This commit is contained in:
parent
818ba48924
commit
df48a1491f
@ -1,5 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using qtc_api.Hubs;
|
||||||
using qtc_api.Services.RoomService;
|
using qtc_api.Services.RoomService;
|
||||||
|
|
||||||
namespace qtc_api.Controllers
|
namespace qtc_api.Controllers
|
||||||
@ -22,7 +23,7 @@ namespace qtc_api.Controllers
|
|||||||
public async Task<ActionResult<ServiceResponse<Room>>> CreateRoom(string userId, RoomDto request)
|
public async Task<ActionResult<ServiceResponse<Room>>> CreateRoom(string userId, RoomDto request)
|
||||||
{
|
{
|
||||||
var response = await _roomService.AddRoom(userId, request);
|
var response = await _roomService.AddRoom(userId, request);
|
||||||
await _hubContext.Clients.All.SendAsync("cf", "rul");
|
await _hubContext.Clients.All.SendAsync("cf", "rr");
|
||||||
return Ok(response);
|
return Ok(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,10 @@ namespace qtc_api.Controllers
|
|||||||
public class UsersController : ControllerBase
|
public class UsersController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private readonly IConfiguration _configuration;
|
|
||||||
|
|
||||||
public UsersController(IUserService userService, IConfiguration configuration)
|
public UsersController(IUserService userService)
|
||||||
{
|
{
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
_configuration = configuration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("all")]
|
[HttpGet("all")]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace qtc_gateway.Hubs
|
namespace qtc_api.Hubs
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class ChatHub : Hub
|
public class ChatHub : Hub
|
||||||
@ -46,7 +46,7 @@ namespace qtc_gateway.Hubs
|
|||||||
ConnectedUsers.Add(new UserConnectionDto() { ConnectedUser = user, ConnectionId = Context.ConnectionId });
|
ConnectedUsers.Add(new UserConnectionDto() { ConnectedUser = user, ConnectionId = Context.ConnectionId });
|
||||||
OnlineUsers.Add(user);
|
OnlineUsers.Add(user);
|
||||||
|
|
||||||
ServerConfig serverConfig = JsonSerializer.Deserialize<ServerConfig>(JsonDocument.Parse(File.ReadAllText("./ServerConfig.json")));
|
ServerConfig serverConfig = JsonDocument.Parse(File.ReadAllText("./ServerConfig.json")).Deserialize<ServerConfig>();
|
||||||
|
|
||||||
await Clients.Client(ConnectedUsers.FirstOrDefault(e => e.ConnectionId == Context.ConnectionId)!.ConnectionId!).SendAsync("rc", serverConfig);
|
await Clients.Client(ConnectedUsers.FirstOrDefault(e => e.ConnectionId == Context.ConnectionId)!.ConnectionId!).SendAsync("rc", serverConfig);
|
||||||
await Clients.All.SendAsync("cf", "rul");
|
await Clients.All.SendAsync("cf", "rul");
|
||||||
|
@ -10,7 +10,7 @@ global using qtc_api.Services.UserService;
|
|||||||
global using Microsoft.IdentityModel.Tokens;
|
global using Microsoft.IdentityModel.Tokens;
|
||||||
global using System.Text;
|
global using System.Text;
|
||||||
global using qtc_api.Services.TokenService;
|
global using qtc_api.Services.TokenService;
|
||||||
global using qtc_gateway.Hubs;
|
global using qtc_api.Hubs;
|
||||||
using qtc_api.Services.RoomService;
|
using qtc_api.Services.RoomService;
|
||||||
using qtc_api.Services.ContactService;
|
using qtc_api.Services.ContactService;
|
||||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user