Skip to content

Instantly share code, notes, and snippets.

View mikaelmello's full-sized avatar

Mikael Mello mikaelmello

View GitHub Profile
@mikaelmello
mikaelmello / clientcommands.md
Last active June 26, 2018 01:01 — forked from timkinnane/clientcommands.md
Client Commands

I'd like to introduce a new utility called Client Commands, a solution created to allow the Rocket.Chat server to trigger actions in subscriber clients (bots and possibly other websocket clients). This is handled at the adapter and/or SDK level, not by final users (e.g. normal bot developers).

The problem

Bots subscribe to a message stream and respond to message events, but there's no way for the server to prompt them to do anything other than that.

In order to provide a range of new management features for administrating bot clients, getting data or triggering any non message response action, we need to send data to be interpreted by the client as a command. Such data, identified here by ClientCommands, could not be sent through the normal message stream, because:

  • a) it would need hack workarounds to filter commands from normal message data
  • b) it would be kept forever, bloating message collection storage