public override ANetChannel Connect() { if (this.ClientChannel == null) { ClientChannel = new WcpChannel(this.HttpPrefixed, this, this.Network) { OnConnected = c => { OnConnect(c); c.StartRecv(); } }; ClientChannel.StartConnecting(); } return(this.ClientChannel); }
private async Task <ANetChannel> HandleAccept(HttpListenerContext context) { var wsContext = await context.AcceptWebSocketAsync(null); var client = wsContext.WebSocket; var channel = new WcpChannel(this.HttpPrefixed, client, this) { LocalEndPoint = context.Request.LocalEndPoint, RemoteEndPoint = context.Request.RemoteEndPoint, }; return(channel); }