Skip to content

Commit 59f6a90

Browse files
docs: update send docs
1 parent 03d2105 commit 59f6a90

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

api/src/websocket/WebSocketClient.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,23 @@ export class ArunaClient extends EventEmitter {
9292
}
9393

9494
/**
95-
* Sends a message to the ArunaCore server
96-
* @param {string} command Command identifier of the message (100, 101, 102, etc...)
97-
* @param {string[]} args Arguments of the message
98-
* @param {string?} [to] Target of the message
99-
* @param {string?} [targetKey] Target key of the message
100-
* @param {string?} [type] Client type
101-
* @returns {Promise<void>}
95+
* Sends a message to the ArunaCore server.
96+
*
97+
* @param {any} content - Content of the message, can be a string or a serializable object.
98+
* @param {Object} options - Options for the message.
99+
* @param {string} [options.type] - Type of the client or message.
100+
* @param {string} [options.command] - Command code for the message.
101+
* @param {{ id: string, key?: string }} [options.target] - Target of the message (id and optional key).
102+
* @param {string[]} [options.args] - Arguments of the message.
103+
* @returns {Promise<void>} Resolves when the message is sent.
104+
*
102105
* @example
103-
* client.send('100', ['Hello World!'], 'server', 'serverKey', 'client');
106+
* await client.send('100', {
107+
* args: ['Hello World!'],
108+
* target: { id: 'server', key: 'serverKey' },
109+
* type: 'client',
110+
* command: 'someCommand'
111+
* });
104112
*/
105113
public async send(content: any, { type, command, target, args }: { type?: string, command?: string, target?: { id: string, key?: string }, args?: string[] }): Promise<void> {
106114
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)