laravel框架中使用的代碼:
/**
* socket服務器ID綁定
*/
public function postSocketBind()
{
Gateway::$registerAddress = '127.0.0.1:1238';
$socket_id = \request()->input('client_id');
session()->put("socket_id",$socket_id);
Gateway::bindUid(session('socket_id'), \App\model\user::userInfo()->id);
}
報下面錯誤
stream_socket_client(): unable to connect to tcp://0.0.0.0: (Failed to parse address "0.0.0.0:")
修改代碼 /vendor/workerman/gatewayclient/Gateway.php,這樣就正常了。好像默認給不了一個端口
class Context{
public static $local_port = 1238;
}