[LayaNative 1.0]native 1.0.2 连不上wss

<html>
<head>
</head>
<body>
<script>
var ws = new WebSocket("wss://login.huanxi.twbuyu.com:27777");
ws.onopen = function() {
alert("connect success~");
ws.send('tom');
alert("send to server msg: tom");
};
ws.onmessage = function(e) {
alert("accpet msg: " + e.data);
};
ws.onerror = function(e) {
alert("error: " + e);
console.log(e)
};
</script>
</body>
</html>
 
这是app设置的url所对应的html文件,在web端是能连上socket的,app里面就连不上
(简单起见这里直接使用原生websocket,使用laya封装的socket效果一样)
 
xcode部分日志如下:
game[3393:1312918] WebSocket::init m_host: login.huanxi.twbuyu.com, m_port: 27777, m_path: /
NOTICE: Initial logging level 7
NOTICE: Libwebsockets version: 2.3.0 layabox_mac@localhost-
NOTICE: IPV6 compiled in and enabled
NOTICE: libev support not compiled in
NOTICE: libuv support not compiled in
NOTICE: Threads: 1 each 2560 fds
NOTICE: mem: platform fd map: 20480 bytes
NOTICE: Compiled with OpenSSL support
NOTICE: Doing SSL library init
NOTICE: Creating Vhost 'default' port -1, 1 protocols, IPv6 on
NOTICE: lws_context_init_client_ssl: doing cert filepath
NOTICE: Loaded client cert /var/mobile/Containers/Data/Application/191B3AE2-4606-48EF-932D-E1D1A59B5773/Library/Caches/ssl.crt
NOTICE: lws_context_init_client_ssl: doing private key filepath
NOTICE: Loaded client cert private key /var/mobile/Containers/Data/Application/191B3AE2-4606-48EF-932D-E1D1A59B5773/Library/Caches/ssl.pem
NOTICE: mem: per-conn: 584 bytes + protocol rx buf
NOTICE: lws_client_connect_2: 0x129242030: address login.huanxi.twbuyu.com
NOTICE: lws_client_connect_2: 0x129242030: address login.huanxi.twbuyu.com
ERR: SSL error: unable to get local issuer certificate (preverify_ok=0;err=20;depth=1)
ERR: SSL connect error 337047686: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
看起来像是证书问题,可是web端是能访问的,不清楚什么问题
已邀请:

Aar0n

赞同来自:

更新至最新版native1.0.x 或 native2.0.x 即可连接wss

guozhaokui

赞同来自:

给个真的地址能连上的我测试一下

Aar0n

赞同来自:

LayaNative2.0.3 可以连接wss了。

该问题目前已经被锁定, 无法添加新回复

商务合作
商务合作