WebSocketManager.cs 560 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections.Concurrent;
  3. using System.Net.WebSockets;
  4. namespace Emby.Server.Implementations.WebSockets
  5. {
  6. public class WebSocketManager
  7. {
  8. private readonly ConcurrentDictionary<Guid, WebSocket> _activeWebSockets;
  9. public WebSocketManager()
  10. {
  11. _activeWebSockets = new ConcurrentDictionary<Guid, WebSocket>();
  12. }
  13. public void AddSocket(WebSocket webSocket)
  14. {
  15. var guid = Guid.NewGuid();
  16. _activeWebSockets.TryAdd(guid, webSocket);
  17. }
  18. }
  19. }