ApiServer编译通过,测试失败,IMessage要换成Packet,过滤器、编码器等是否保留还需要考虑
大石头 authored at 2018-04-23 02:06:49
754.00 B
X
using System;
using NewLife.Http;
using NewLife.Net;

namespace NewLife.Remoting
{
    class ApiHttpClient : ApiNetClient
    {
        public override Boolean Init(Object config)
        {
            if (config is NetUri uri)
                Client = uri.CreateRemote();
            //else if (config is Uri)
            //    Client = ((Uri)config).CreateRemote();
            //else if (config is String)
            //    Client = new Uri(config + "").CreateRemote();

            // Http封包协议
            Client.Add<HttpCodec>();

            // 网络非法断开时,自动恢复
            Client.OnDisposed += (s, e) => { if (Active) { Init(config); Open(); } };

            return true;
        }
    }
}