Skip to content

Companion API

The Companion API provides limited integration with the social-companion client.

This API allows servers to communicate with the client through custom payloads in order to enable enhanced chat functionality such as channel tabs, mentions, and message previews.

Detecting `social-companion

You can determine whether a SocialUser is connected using the companion client by checking the Optional object:

boolean isCompanion = user.companion().isPresent();
If present, companion-specific features can be safely used for that user.

Protocol

Communication between the server and the companion client uses custom payloads. Custom payloads are also known as plugin messages in Bukkit and its forks. This section discloses those custom payloads:

Client-server Parameters Description
social:open S2C Channel name, alias, icon & description Opens a new channel tab
social:close S2C Channel name Closes an existing channel tab
social:closeall S2C Reason (can be empty) Closes all channel tabs
social:mention S2C Channel name, sender name, sender UUID Sends a mention notification
social:switch Both Channel name Switches the current main channel
social:preview Both C2S -> Plain text, S2C -> Formatted text Sends/requests a chat preview
social:bonjour C2S Empty string Enables companion features server-side
social:refresh C2S Reason (optional) Requests the server to refresh data