Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自己部署的demo版本,可以测试websocket么? #23

Closed
haonit opened this issue Jul 20, 2021 · 11 comments
Closed

自己部署的demo版本,可以测试websocket么? #23

haonit opened this issue Jul 20, 2021 · 11 comments

Comments

@haonit
Copy link

haonit commented Jul 20, 2021

No description provided.

@liguobao
Copy link
Collaborator

可以的,不过要注意https证书的问题,这个就自行解决了。

@haonit
Copy link
Author

haonit commented Jul 20, 2021

可以的,不过要注意https证书的问题,这个就自行解决了。

release的1.2版本,说是只配一个5620端口,我用wireshark抓了5620端口的包,返回400错误啊,你确定可以?

@liguobao
Copy link
Collaborator

liguobao commented Jul 20, 2021

是的。
请使用最简单的HTML + JS来测试。

<html>
    <script src="https://sekiro.virjar.com/sekiro-doc/assets/sekiro_web_client.js"></script>
    <script>
        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://localhost:5620/register?group=ws-group-2&clientId=" + guid());

        client.registerAction("clientTime", function (request, resolve, reject) {
            resolve("SekiroTest:" + new Date());
        });

        client.registerAction("executeJs", function (request, resolve, reject) {
            var code = request['code'];
            if (!code) {
                reject("need param:{code}");
                return;
            }

            code = "return " + code;

            console.log("executeJs: " + code);

            try {
                var result = new Function(code)();
                resolve(result);
            } catch (e) {
                reject("error: " + e);
            }

        });
    </script>
</html>

@haonit
Copy link
Author

haonit commented Jul 20, 2021

是的。
请使用最简单的HTML + JS来测试。

image
不好意思,我这边真不知道哪里有问题

@liguobao
Copy link
Collaborator

var client = new SekiroClient("ws://localhost:5620/register?group=ws-group-2&clientId=" + guid());

修改一下这里。

@liguobao
Copy link
Collaborator

文档请参考 https://sekiro.virjar.com/sekiro-doc

@haonit
Copy link
Author

haonit commented Jul 20, 2021

文档请参考 https://sekiro.virjar.com/sekiro-doc

image
好吧,我是看了这里http的api都是business-demo,
我看例子里的websocket是new SekiroClient("wss://sekiro.virjar.com/business/register?group=ws-group-2&clientId=" + guid());
所以我想着demo的websocket就是new SekiroClient("wss://127.0.0.1/business-demo/register?group=ws-group-2&clientId=" + guid());了

@liguobao
Copy link
Collaborator

注册接口不太一样。

@haonit
Copy link
Author

haonit commented Jul 20, 2021

可以的,不过要注意https证书的问题,这个就自行解决了。

还请问一下,怎么加证书呢?需要改代码么?

@liguobao
Copy link
Collaborator

Nginx + https证书这种,和sekiro无关的。

@virjar
Copy link
Contributor

virjar commented Jul 21, 2021

我改下,businiess-demo我也加上,保持和文档同步

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants