我正在尝试建立一个在线渠道.但是返回的auth字符串不正确.
这是后端代码:
class pusherController extends Controller
{
protected $pusher;
public function __construct(PusherManager $pusher)
{
$this->pusher = $pusher;
}
public function pusherPinyinAuth(Request $request)
{
if($request->user()) {
$user = $request->user();
$auth= $this->pusher->presence_auth($request->input('channel_name'),$request->input('socket_id'), $user->id, array('h'=>'user_info'));
return response($auth);
}
}
}
Run Code Online (Sandbox Code Playgroud)
错误信息
Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":null,"message":"Auth value for subscription to presence-5 is invalid: should be of format 'key:signature'"}}}
Run Code Online (Sandbox Code Playgroud)
我猜错误是由auth字符串之前添加的额外':'引起的.但我手动删除它仍然报告相同的错误.这是我的字符串输出:
{auth: ":8dacf362f8fe62bae42c33dfe5511d3d1c42144685d5843a6a6a8014490ed0f6",…}
Run Code Online (Sandbox Code Playgroud)
我正在使用https://github.com/vinkla/pusher的推送桥
我想尝试官方的pusher-php-server,但是在作曲家安装之后,我不知道如何在我的代码中使用它.我想知道https://github.com/pusher/pusher-http-php是否有同样的问题.
归档时间: |
|
查看次数: |
1380 次 |
最近记录: |