Демка с чатом работает

This commit is contained in:
2025-03-13 08:43:48 +03:00
parent 22cf8ede0a
commit 6d9607081c
11 changed files with 112 additions and 15 deletions
+18
View File
@@ -0,0 +1,18 @@
using Example.Events.Shared;
using mROA.Implementation;
namespace Example.Events.Backend;
public class Chat : IChat
{
public void PostSymbol(string symbol, RequestContext context)
{
OnCharPosted?.Invoke(symbol, context);
}
public event Action<string, RequestContext>? OnCharPosted;
public void OnCharPostedExternal(string p0, RequestContext p1)
{
}
}
+22
View File
@@ -0,0 +1,22 @@
using Example.Events.Shared;
using mROA.Implementation.Attributes;
namespace Example.Events.Backend;
[SharedObjectSingleton]
public class ChatFactory : IChatFactory
{
private static readonly Dictionary<Guid, IChat> Chats = new();
public IChat GetChat(Guid id)
{
if (Chats.TryGetValue(id, out var chat))
{
return chat;
}
var created = new Chat();
Chats.Add(id, created);
return created;
}
}