MumbleClient - Rantanen/node-mumble GitHub Wiki
Mumble client API
Params
- connection
MumbleConnection
- The underlying connection.
Instances should be created with Mumble.connect().
-
MumbleClient(connection)
-
Methods
- authenticate(name, password, tokens)
- channelById(id)
- channelByName(name)
- channelByPath(path)
- disconnect()
- inputStream(options)
- inputStreamForUser(sessionId, options)
joinPath(path)- outputStream(userid)
- sendMessage(message, recipients)
- sendVoice(chunk)
- userById(id)
- userByName(name)
- userBySession(id)
- users()
- Properties
- Events
-
Methods
Authenticate on the server.
Params
- name
string
- Username. Ignored for registered users who will use the username registered with the certificate. - password
string
- Optional password. Required if the username is in use and certificate isn't supplied. - tokens
Array.<string>
- list of ACL tokens to apply on connection
This method must be invoked to start the authentication handshake. Once the
handshake is done the client emits initialized
event and the rest of the
functionality will be available.
Find a specific channel by its channel_id.
Params
- id
number
- Channel ID to search for.
Returns: Channel
- The channel found or undefined.
Find a specific channel by its name.
Params
- name
string
- Channel name to search for.
Returns: Channel
- The first channel found or undefined.
FInd a specific channel by its path.
Params
- path
string
- Channel path
Returns: Channel
- The channel found or undefined.
Disconnects the client.
Retrieves an audio input stream.
Params
- options
Object
- Input stream options.
Returns: MumbleInputSTream
- -
Input stream for streaming audio to the server.
Allocates an input stream for a specific user session
Params
- sessionId
number
|Array
- Single user session ID or an array of those. - options
Object
- Input stream options.
Returns: MumbleInputStream
- Input stream
Deprecated
Join a channel specified by a Mumble URL
Params
- path
string
- Path to join.
Retrieves an audio output stream.
Params
- userid
number
- Optional user session ID. Defines the user whose audio the stream will handle. If omitted the stream will output mixed audio.
Returns: MumbleOutputStream
- -
Output stream that can be used to stream the audio out.
Sends a text message to recipients.
Params
- message
string
- The text to send. - recipients
Array.<Object>
- Target users.- .session
Array.<number>
- Session IDs of target users. - .channel_id
Array.<number>
- Channel IDs of target channels.
- .session
Previously a method with the same name was used to send raw Mumble protocol messages. Use MumbleConnection#sendMessage for that now.
Sends a raw voice frame to the server.
Params
- chunk
Buffer
- 16bitLE PCM buffer of voice audio.
Consider using the streams.
Find a specific user by their user ID.
Params
- id
number
- The user ID to search for.
Returns: User
- The user found or undefined.
User ID exists only on registered users. The ID will remain the same between different sessions.
Find a specific user by its name.
Params
- name
string
- User name to search for.
Returns: User
- The user found or undefined.
Find a specific user by their session ID.
Params
- id
number
- The session ID to search for.
Returns: User
- The user found or undefined.
Every connected user has a session ID. The ID identifies the current connection and will change when the user reconnects.
Returns all users currently connected to the server.
Returns: Array.<User>
- Users connected to the server
The internal MumbleConnection object.
The connection object is used for the low level access to the Mumble protocol. Most developers should find a higher level APIs for the functionality on the MumbleClient class instead.
Defines whether the connection has been succesffully handshaken.
The connection is considered ready
when the server handshake has been
processed and the initial ping has been received.
The server root channel.
The current user.
Emitted for the channel events.
Params
- channel
Channel
- The channel that caused the event. - ...arguments
*
- The original event arguments.
The events on the Channel objects are available through the Client as well. These events can be used to subscribe to the events on all the channels at the same time.
Example
client.on( 'channel-move', function( channel ) {
console.log( 'Channel ' + channel.name + ' was moved' );
});
Emitted when a new channel is created.
Params
- channel
Channel
- The new channel.
Emitted for errors.
Params
- error
MumbleError
- The error details.
This event MUST be handled or the error object is thrown instead which will likely crash the node process with a proper error message.
Emitted when a text message is received.
Params
- message
string
- The text that was sent. - user
User
- The user who sent the message. - scope
string
- The scope in which the message was received. 'user' if the message was sent directly to the current user or 'channel 'if it was received through the channel.
Emitted for the user events.
Params
- user
User
- The user that caused the event. - ...arguments
*
- The original event arguments.
The events on the User objects are available through the Client as well. These events can be used to subscribe to the events on all the users at the same time.
Example
client.on( 'user-move', function( user ) {
console.log( 'User ' + user.name + ' moved' );
});
Emitted when a new user connects to the server.
Params
- user
User
- The connected user.