wokerman进行ssl连接出错

aton
$context = array(
        'ssl' => array(
            'local_cert'  => GLOBAL_SSL_PEM, // 或者crt文件
            'local_pk'    => GLOBAL_SSL_KEY,
            'verify_peer' => false
        )
    );
    $gateway = new Gateway("websocket://0.0.0.0:".GLOBAL_GATEWAY_PORT);
    $gateway->transport = 'ssl';

用的是阿里云免费ssl证书

日志输出

onConnect:client_id-ac123f940fa200000005成功连接
PHP Warning:  stream_socket_enable_crypto(): SSL_R_NO_SHARED_CIPHER: no suitable shared cipher could be used.  This could be because the server is missing an SSL certificate (local_cert context option) in /home/GatewayWorker/vendor/workerman/workerman/Connection/TcpConnection.php on line 391

Warning: stream_socket_enable_crypto(): SSL_R_NO_SHARED_CIPHER: no suitable shared cipher could be used.  This could be because the server is missing an SSL certificate (local_cert context option) in /home/GatewayWorker/vendor/workerman/workerman/Connection/TcpConnection.php on line 391

SSL Handshake fail. 
Buffer:
onClose:client_id-ac123f940fa200000005断开连接
Workerman version:3.4.3          PHP version:7.0.2
start time:2017-07-22 23:07:45   run 0 days 0 hours   
load average: 0, 0, 0            event-loop:\Workerman\Events\Select
3 workers       9 processes
worker_name  exit_status     exit_count
Worker       0                0
Gateway      0                0
Register     0                0
---------------------------------------PROCESS STATUS-------------------------------------------
pid     memory  listening                worker_name  connections total_request send_fail throw_exception
2143    2M      none                     Worker       5           71             0         0              
2145    2M      none                     Worker       5           63             0         0              
2144    2M      none                     Worker       5           53             0         0              
2147    2M      websocket://0.0.0.0:8282 Gateway      5           16             0         0              
2146    2M      none                     Worker       5           67             0         0              
2151    2M      text://0.0.0.0:1238      Register     8           80             0         0              
2149    2M      websocket://0.0.0.0:8282 Gateway      5           12             0         0              
2148    2M      websocket://0.0.0.0:8282 Gateway      5           21             0         0              
2150    2M      websocket://0.0.0.0:8282 Gateway      5           20             0         0 
7505 1 0
1个回答

walkor 打赏

按照手册,

$gateway = new Gateway("websocket://0.0.0.0:".GLOBAL_GATEWAY_PORT);

改成

$gateway = new Gateway("websocket://0.0.0.0:".GLOBAL_GATEWAY_PORT, $context);

context 你没有传进去

  • 暂无评论
年代过于久远,无法发表回答
×
🔝