如何使用 Scaledrone 刷新所有连接的客户端?

How do I refresh all connected clients using Scaledrone?

我拥有一个网站,它是我学校大部分人用来聊天的聊天室。有一些烦人的垃圾邮件发送者,最近我想出了一个方法来禁止他们,但他们必须刷新。有什么办法可以刷新我网站上每个人的屏幕并禁止垃圾邮件发送者吗?当我发布更新时使用它并刷新每个人也很有用。

有没有办法使用 Scaledrone 执行此操作,这是我正在使用的库?

是的,你可以。如果您使用的是 Scaledrone,则可以 listen for a specific message and in the handler code call location.reload().

来自上面的 Scaledrone link。您需要修改它以使用您拥有的任何设置。聊天网站的代码是你写的吗?

// Subscribe after the 'open' or 'authenticate' event from the Scaledrone instance
const room = drone.subscribe('room_name');

room.on('message', message => {
  // Received message from room
    const {data, id, timestamp, clientId, member} = message;
   if (member.id === myId && message ==='expelliarmus') {
      location.reload()
  }
});