<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script src="http://file.virjar.com/sekiro_web_client.js?_=123"></script>
<script>
function b64(arg) {
return btoa(arg)
}
// 生成唯一标记uuid编号
function guid() {
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
// 连接服务端
var client = new SekiroClient("ws://127.0.0.1:5620/business-demo/register?group=ws-group&clientId="+guid());
// 业务接口
client.registerAction("demo",function(request, resolve, reject){
data = request['page']
console.log(data,'记号')
resolve("我是Forever"+new Date());
})
client.registerAction("demo1",function(request, resolve, reject){
data = request['pwd']
res = b64(data)
resolve(res);
})
</script>
</body>
</html>
文章来源地址https://uudwc.com/A/pjwRr
sekiro.py
# -*- coding: utf-8 -*-
import requests
data = {"group": "ws-group",
"action": "demo",
"page": 10
}
res = requests.get("http://127.0.0.1:5620/business-demo/invoke",params=data )
print(res.text)
data = {"group": "ws-group",
"action": "demo1",
"pwd": "aaa"
}
res = requests.get("http://127.0.0.1:5620/business-demo/invoke",params=data )
print(res.text)
点击sekiro.bat 启动
启动Html页面
运行sekiro.py 会得到Html页面中resolve的信息
再次刷新页面会显示发送的内容
在sekiro日志中可以看到对应的分组日志
在该接口中可以看到对应的分组列表,一般每个分组可以对应一个网站
文章来源:https://uudwc.com/A/pjwRr