public PowerLineWebsocketClient(PowerLineServer server, HttpListenerContext firstContext, CancellationToken cancelToken) { this.LocalAddress = firstContext.Request.LocalEndPoint.Address.ToString(); this.LocalPort = firstContext.Request.LocalEndPoint.Port; this.RemoteAddress = firstContext.Request.RemoteEndPoint.Address.ToString(); this.RemotePort = firstContext.Request.RemoteEndPoint.Port; this.sendLock = new SemaphoreSlim(1, 1); this.CustomValueLock = new object(); this.CustomValues = new Dictionary <string, object>(); this.events = new Dictionary <string, PowerLineEvent>(); this.eventsLock = new object(); this.Server = server; this.FirstContext = firstContext; this.CancelToken = cancelToken; this.mainTask = new Task(InnerRunner, this.CancelToken, TaskCreationOptions.LongRunning); this.mainTask.Start(); }
public static PowerLineEndPoint GetEndPoint(PowerLineServer server) => new PowerLineEndPoint("Event", new PowerLineHandler[] { new PowerLineEventHandler(server) });
public PowerLineEventHandler(PowerLineServer server) : base("PUT") { this.Server = server; }