gamerpc 9.0.0 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/game/mgr.js DELETED
@@ -1,80 +0,0 @@
1
- d:\workshop\gitee\vallnetserver\test\kow.socket.js/**
2
- * 联机单元测试:远程管理
3
- */
4
-
5
- const assert = require('assert')
6
-
7
- //引入游戏云连接器,创建连接器对象
8
- const {gameconn} = require('../../src/')
9
- const remote = new gameconn({
10
- "UrlHead": "http", //协议选择: http/https
11
- "webserver": {
12
- //注意:如果需要负载均衡,这里一般指定负载均衡服务器地址,否则直接填写业务主机地址
13
- "host": "127.0.0.1", //远程主机地址
14
- "authPort": 9601, //签证主机端口
15
- "port": 9901 //远程主机端口
16
- },
17
- }).setFetch(require('node-fetch')); //设置node环境下兼容的fetch函数
18
-
19
- //切换为长连模式
20
- //remote.setmode(remote.CommMode.ws);
21
-
22
- //这里需要填充管理员登录信息
23
- let admin = {
24
- openid: '',
25
- openkey: '',
26
- }
27
-
28
- describe('远程管理', () => {
29
- it.skip('执行索引服远程指令 remote.printInfo', async () => {
30
- await remote.init(/*初始化连接器,只保留原始配置信息*/).login({
31
- domain: 'CoreOfIndex',
32
- openid: admin.openid,
33
- openkey: admin.openkey,
34
- });
35
-
36
- let msg = await remote.fetching({func: "remote.printInfo"});
37
- console.log(msg);
38
- });
39
-
40
- it.skip('透过索引服执行业务服远程指令 remote.command printInfo', async () => {
41
- await remote.init(/*初始化连接器,只保留原始配置信息*/).login({
42
- domain: 'CoreOfIndex',
43
- openid: admin.openid,
44
- openkey: admin.openkey,
45
- });
46
-
47
- let msg = await remote.fetching({func: "remote.command", data: ['printInfo', 'CoreOfChickIOS', '1']});
48
- console.log(msg);
49
- });
50
-
51
- it('模拟用户注册并登录', async () => {
52
- //执行登录操作,通过配置对象传入用户信息,并指定签证方式为两阶段认证
53
- let auth = {
54
- cpId: 'c376af60-cab5-11ed-90e8-25399b14218a',
55
- addr: '10000000',
56
- name: 'bookman',
57
- bonus: '',
58
- time: Date.now(),
59
- };
60
-
61
- //需要正确填充 auth.sign, 此处采用模拟命令填充, 注意命令 testSign 只在测试模式下开启
62
- await remote.init().login({
63
- domain: 'CoreOfIndex',
64
- openid: admin.openid,
65
- openkey: admin.openkey,
66
- });
67
- let msg = await remote.fetching({func: "remote.command", data: ['testSign', 'CoreOfChickIOS', '1', auth]});
68
- auth.sign = msg['CoreOfChickIOS.1'].sign;
69
-
70
- let ret = await remote.init().login({
71
- domain: 'CoreOfChickIOS', //登录域
72
- openid: `bxs.${auth.addr}`, //用户登录标识,含验证方式
73
- auth,
74
- });
75
- if(!!ret) {
76
- ret = await remote.fetching({func: "test.echo"});
77
- assert(ret.code == 0);
78
- }
79
- });
80
- });