using System; using IotWeb.Common.Http; using System.Threading.Tasks; using System.Collections.Generic; using System.Diagnostics; namespace Nibriboard.Client { public class NibriClientManager : IWebSocketRequestHandler { List clients = new List(); public NibriClientManager() { } /// /// Whether we will accept a given new WebSocket connection or not. /// /// The uri the user connected to. /// The protocol the user is connecting with. /// Whether we want to accept the WebSocket connection attempt or not. public bool WillAcceptRequest(string uri, string protocol) { Log.WriteLine("[Nibriboard/Websocket] Accepting {0} via {1}.", uri, protocol); return true; } /// /// Handles WebSocket clients when they first connect, wrapping them in /// a instance and adding them to /// the client list. /// /// New socket. public void Connected(WebSocket newSocket) { NibriClient client = new NibriClient(this, newSocket); clients.Add(client); } } }