Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
W
WSCF
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
WSCF
Commits
7a4a5895
Commit
7a4a5895
authored
Nov 06, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test项目:
简化创建服务代码
parent
81c4c6f5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
WsProxy.cs
WSCF.Test/Server.WsProxy/WsProxy.cs
+14
-10
No files found.
WSCF.Test/Server.WsProxy/WsProxy.cs
View file @
7a4a5895
...
@@ -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
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment