Ejemplo n.º 1
0
        public WChannel(long id, WebSocket webSocket, string connectUrl, WService service)
        {
            this.Id          = id;
            this.Service     = service;
            this.ChannelType = ChannelType.Connect;
            this.webSocket   = webSocket;
            this.recvStream  = new MemoryStream(ushort.MaxValue);

            isConnected = false;

            this.Service.ThreadSynchronizationContext.PostNext(() => this.ConnectAsync(connectUrl).Coroutine());
        }
Ejemplo n.º 2
0
        public WChannel(long id, HttpListenerWebSocketContext webSocketContext, WService service)
        {
            this.Id               = id;
            this.Service          = service;
            this.ChannelType      = ChannelType.Accept;
            this.WebSocketContext = webSocketContext;
            this.webSocket        = webSocketContext.WebSocket;
            this.recvStream       = new MemoryStream(ushort.MaxValue);

            isConnected = true;

            this.Service.ThreadSynchronizationContext.PostNext(() =>
            {
                this.StartRecv().Coroutine();
                this.StartSend().Coroutine();
            });
        }