TeamSpeak Websocket API
Connecting
The websocket is available to connect to @ ws://localhost:33802
. FiveM blocks all connections to localhost
and 127.0.0.1
, so use ws://[::1]:33802
instead (the IPv6 counterpart). This is not a secure websocket connection.
type field
All events MUST include a type
field that will indicate the type of event that is being passed. The other fields of the event will depend on type
.
to_cid field
Unless otherwise specified, all client->ws events SHOULD accept an optional to_cid
field. This field dictates to which connection (or tab) the event is being passed to. If this field is ommitted, then the event will be dispatched to all connections.
Structures
Includes all structures that will be frequently used across the client.
frequency
client_state
client_gamestate
Since: 0.1.2
server_config
controller
There is one unique controller per authorized connection (tab). If the connection is not authorized to use Sonoran Radio, then the controller does not exist.
channel_client
Client->WS Events
All events will be categorized by their type
field, with an example of what each event will do. All events, except ones specifically stating otherwise, will accept to_cid
.
Errors
If an exception (error) occurs while handling an event, it will dispatch a ws->client events that contains error information.
get_controllers
Will immediately produce the recv_controllers
ws->client event
Minimum tier: Free
get_controller_data
Will immediately produce the recv_controller_data
ws->client. Recommended to be used with to_cid
, otherwise just use get_controllers
.
Minimum tier: Free
set_frequencies
Sets the XMIT & RECV frequencies of own client
Minimum tier: Plus
set_frequencies_scanned
Minimum tier: Pro
set_scanning_enabled
Minimum tier: Pro
set_gamestate
Should be called often. If left untouched for >5m, state.game
will revert to null
Since: 0.1.2 Minimum tier: Free
print_chat_message
Prints a message to the chat (only local user can see). Supports TeamSpeak formatting (like BBCode)
Minimum tier: Plus
change_channel
Changes the channel of the current client
Minimum tier: Plus
WS->Client Events
All events will be categorized by their type
field, with an example of what each event will do.
recv_controllers
Transmitted to the connection directly after get_controllers
is fired.
recv_controller_data
Transmitted to the connection directly after get_controller_data
is fired.
controller_created
A new connection controller has been established. This means there is a new connection (tab) to communicate to.
controller_destroyed
An exist connection controller has been destroyed. You are no longer able to communicate with it.
config_changed
The server configuration of a controller has been updated. Note that this does not necessarily mean that the fields of the config have changed, it has just received a new "version"
frequencies_updated
The client frequencies have updated. This may have been the result of interaction in the plugin, or from an event from a websocket client.
frequencies_scanned_updated
local_channel_changed
The user of the plugin has changed channels.
channel_clients_changed
There has been some update to the clients currently in the channel with the plugin user. Note that this will not broadcast if a channel client updates their state.
client_xmit_change
Broadcasted whenever a client in a patrol channel begins or ends a transmission. This will be broadcasted if any client speaks, even if this client cannot hear the other.
The xmit_type
is the internal mic click identifier. *_talk_permit
at the beginning of a transmission, and *_squelch
is at the end of a transmission. The current values passed are (NOTE: may change in the future):
self_talk_permit
self_squelch
unit_talk_permit
unit_squelch
Last updated