Commit 7a4a5895 authored by 潘栩锋's avatar 潘栩锋 🚴

Test项目:

简化创建服务代码
parent 81c4c6f5
...@@ -15,17 +15,21 @@ namespace WSCF.Test.Server.WsProxy ...@@ -15,17 +15,21 @@ namespace WSCF.Test.Server.WsProxy
public WsProxy(string addr, Foo foo) public WsProxy(string addr, Foo foo)
{ {
wssv = new WebSocketServer($"ws://{addr}/"); wssv = new WebSocketServer($"ws://{addr}/");
wssv.AddWebSocketService<Reflect_Proxy>("/Foo", (wsproxy) =>
{
//wsproxy.Init(typeof(IFooService), foo);
wsproxy.AfterOpen = (proxy) =>
{
//分解 路径
string path = proxy.Context.RequestUri.PathAndQuery;
proxy.Init(typeof(IFooService), foo); wssv.AddWebSocketService<Reflect_Proxy>("/Foo", (wsproxy) => wsproxy.Init(typeof(IFooService), foo));
};
}); //wssv.AddWebSocketService<Reflect_Proxy>("/Foo", (wsproxy) =>
//{
// wsproxy.AfterOpen = (proxy) =>
// {
// //分解 路径
// string path = proxy.Context.RequestUri.PathAndQuery;
// //TODO
// proxy.Init(typeof(IFooService), foo);
// };
//});
//如果有多个服务,就继续 wssv.AddWebSocketService<Reflect_Proxy> //如果有多个服务,就继续 wssv.AddWebSocketService<Reflect_Proxy>
this.wssv.Start(); this.wssv.Start();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment