Пример #1
0
        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();
        }
Пример #2
0
 public static PowerLineEndPoint GetEndPoint(PowerLineServer server) => new PowerLineEndPoint("Event", new PowerLineHandler[] { new PowerLineEventHandler(server) });
Пример #3
0
 public PowerLineEventHandler(PowerLineServer server) : base("PUT")
 {
     this.Server = server;
 }