本文介绍了如何在 Pusher 中更改会员信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Pusher(Javascript 客户端和 PHP 服务器库)开发实时多用户应用.

I am using Pusher (Javascript Client and PHP Server libraries) to develop a realtime multiuser app.

为了分配每个用户的状态,我为每个成员分配了一个自定义变量(测试),我正在通过 member.info.var 访问此信息

To assign the state of each user, I have assigned a custom variable (test) for each member and I am accessing this information through member.info.var

如何为特定用户更改此值,以便在所有其他用户访问时将其反映到?

How can I change this value for a particular user so that it is reflected to all other users when they access?

如果我只是更改 channel.members.me.info.var,那么当我从另一个用户访问相同的内容时,它不会被反映.任何帮助表示赞赏.

If I simply change channel.members.me.info.var then when I access the same from another user, it is not being reflected. Any help appreciated.

推荐答案

您目前无法更改此设置并将其持久化到 Pusher 服务中.

You can't change this and have it persisted to the Pusher service at the moment.

唯一的选择是有点黑客.

The only option for this is a bit of a hack.

  1. 断开用户连接pusher.disconnect()
  2. 连接用户并作为在线身份验证的一部分提供更新的成员信息 (user_info)

当我在 Pusher 工作时,这是一个相当频繁的请求功能,因此我还建议删除 Pusher 支持注释以请求此功能.

When I worked at Pusher this was a reasonably frequently requested feature so I'd also recommend dropping Pusher support a note to request this feature.

这篇关于如何在 Pusher 中更改会员信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 21:10