如果GatewayClient和GatewayWorker不是在同一臺服務(wù)器上,則需要先將start_gateway.php中的lanIp改成當(dāng)前服務(wù)器的內(nèi)網(wǎng)ip(如果不在一個內(nèi)網(wǎng)可改成公網(wǎng)ip)
華為云的服務(wù)器跟公網(wǎng)IP是分開的,如果設(shè)置成公網(wǎng)IP啟動時就會報錯Warning: stream_socket_server(): unable to connect to tcp://xxxxxxxxx:2903 (Cannot assign requested address)
這種情況無法使用gatewayClient。
http://doc2.workerman.net/push-in-other-project.html
可以考慮手冊里的方案三
@1:按手冊里面的操作報錯。Fatal error: Uncaught Exception: Cannot assign requested address in /www/wwwroot/workerman-chat-hz/vendor/workerman/workerman/Worker.php:2257