Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
若汝棋茗
RRQMSocket
提交
eac215c0
RRQMSocket
项目概览
若汝棋茗
/
RRQMSocket
11 个月 前同步成功
通知
20
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
RRQMSocket
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eac215c0
编写于
9月 24, 2022
作者:
若
若汝棋茗
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整示例
上级
96a2c05d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
27 deletion
+17
-27
examples/Consul集群示例/TouchRpc Consul集群/ServiceConsoleApp/Program.cs
...Consul集群示例/TouchRpc Consul集群/ServiceConsoleApp/Program.cs
+15
-25
examples/JsonRpc简单示例/JsonRpcConsoleApp/Program.cs
examples/JsonRpc简单示例/JsonRpcConsoleApp/Program.cs
+2
-2
未找到文件。
examples/Consul集群示例/TouchRpc Consul集群/ServiceConsoleApp/Program.cs
浏览文件 @
eac215c0
...
...
@@ -35,41 +35,31 @@ namespace ServiceConsoleApp
{
a
.
SetSingletonLogger
<
ConsoleLogger
>();
})
.
ConfigureRpcStore
(
a
=>
{
a
.
RegisterServer
<
MyServer
>();
})
.
ConfigurePlugins
(
a
=>
{
a
.
UseWebSocket
()
//添加WebSocket功能
.
SetWSUrl
(
"/ws"
);
a
.
Add
<
MyWebSocketPlug
>();
//添加WebSocket业务数据接收插件
a
.
Add
<
MyWebSocketCommand
>();
//添加WebSocket快捷实现,常规WS客户端发送文本“Add 10 20”即可得到30。
a
.
Add
<
XmlRpcParserPlugin
>().
SetXmlRpcUrl
(
"/xmlrpc"
);
a
.
Add
<
JsonRpcParserPlugin
>().
SetJsonRpcUrl
(
"/jsonrpc"
);
a
.
Add
<
WebApiParserPlugin
>();
})
.
BuildWithHttpTouchRpcService
();
service
.
Logger
.
Info
(
"Http服务器已启动"
);
service
.
AddPlugin
<
WebSocketServerPlugin
>().
//添加WebSocket功能
SetWSUrl
(
"/ws"
);
service
.
Logger
.
Info
(
$"WS插件已加载,使用 ws://127.0.0.1:
{
port
}
/ws 连接"
);
service
.
AddPlugin
<
MyWebSocketPlug
>();
//添加WebSocket业务数据接收插件
service
.
AddPlugin
<
MyWebSocketCommand
>();
//添加WebSocket快捷实现,常规WS客户端发送文本“Add 10 20”即可得到30。
service
.
Logger
.
Info
(
"WS命令行插件已加载,使用WS发送文本“Add 10 20”获取答案"
);
IRpcParser
jsonRpcParser
=
service
.
AddPlugin
<
JsonRpcParserPlugin
>()
.
SetJsonRpcUrl
(
"/jsonrpc"
);
service
.
Logger
.
Info
(
$"jsonrpc插件已加载,使用 Http://127.0.0.1:
{
port
}
/jsonrpc +JsonRpc规范调用"
);
IRpcParser
xmlRpcParser
=
service
.
AddPlugin
<
XmlRpcParserPlugin
>()
.
SetXmlRpcUrl
(
"/xmlrpc"
);
service
.
Logger
.
Info
(
$"jsonrpc插件已加载,使用 Http://127.0.0.1:
{
port
}
/xmlrpc +XmlRpc规范调用"
);
IRpcParser
webApiParser
=
service
.
AddPlugin
<
WebApiParserPlugin
>();
service
.
Logger
.
Info
(
$"xmlrpc插件已加载,使用 Http://127.0.0.1:
{
port
}
/xmlrpc +XmlRpc规范调用"
);
service
.
Logger
.
Info
(
"WebApi插件已加载"
);
RpcStore
rpcStore
=
new
RpcStore
(
new
TouchSocket
.
Core
.
Dependency
.
Container
());
rpcStore
.
AddRpcParser
(
"httpTouchRpcService"
,
service
);
rpcStore
.
AddRpcParser
(
"jsonRpcParser"
,
jsonRpcParser
);
rpcStore
.
AddRpcParser
(
"xmlRpcParser"
,
xmlRpcParser
);
rpcStore
.
AddRpcParser
(
"webApiParser"
,
webApiParser
);
rpcStore
.
RegisterServer
<
MyServer
>();
service
.
Logger
.
Info
(
"RPC注册完成。"
);
//rpcStore.ShareProxy(new IPHost(8848));
//rpcStore.ProxyUrl = "/proxy";
//service.Logger.Message("RPC代理文件已分享,使用 Http://127.0.0.1:8848/proxy?proxy=all 获取");
RegisterConsul
(
port
);
service
.
Logger
.
Info
(
"Consul已成功注册"
);
...
...
examples/JsonRpc简单示例/JsonRpcConsoleApp/Program.cs
浏览文件 @
eac215c0
...
...
@@ -61,8 +61,8 @@ namespace JsonRpcConsoleApp
})
.
ConfigurePlugins
(
a
=>
{
a
.
Add
<
WebSocketServerPlugin
>()
.
SetWSUrl
(
"/ws"
);
//
启用websocket,
使用/ws路由连接。
a
.
UseWebSocket
()
//启用websocket。
.
SetWSUrl
(
"/ws"
);
//使用/ws路由连接。
a
.
Add
<
JsonRpcParserPlugin
>()
.
SetJsonRpcUrl
(
"/jsonRpc"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录