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;
}
这个报错我遇到过,是因为client_id传错误了,传成了null 或者0