MumbleClient - Rantanen/node-mumble GitHub Wiki

MumbleClient(connection)

Mumble client API

Params

  • connection MumbleConnection - The underlying connection.

Instances should be created with Mumble.connect().

mumbleClient.authenticate(name, password, tokens)

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.

mumbleClient.channelById(id)

Find a specific channel by its channel_id.

Params

  • id number - Channel ID to search for.

Returns: Channel - The channel found or undefined.

mumbleClient.channelByName(name)

Find a specific channel by its name.

Params

  • name string - Channel name to search for.

Returns: Channel - The first channel found or undefined.

mumbleClient.channelByPath(path)

FInd a specific channel by its path.

Params

  • path string - Channel path

Returns: Channel - The channel found or undefined.

mumbleClient.disconnect()

Disconnects the client.

mumbleClient.inputStream(options)

Retrieves an audio input stream.

Params

  • options Object - Input stream options.

Returns: MumbleInputSTream - - Input stream for streaming audio to the server.

mumbleClient.inputStreamForUser(sessionId, options)

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

mumbleClient.joinPath(path)

Deprecated

Join a channel specified by a Mumble URL

Params

  • path string - Path to join.

mumbleClient.outputStream(userid)

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.

mumbleClient.sendMessage(message, recipients)

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.

Previously a method with the same name was used to send raw Mumble protocol messages. Use MumbleConnection#sendMessage for that now.

mumbleClient.sendVoice(chunk)

Sends a raw voice frame to the server.

Params

  • chunk Buffer - 16bitLE PCM buffer of voice audio.

Consider using the streams.

mumbleClient.userById(id)

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.

mumbleClient.userByName(name)

Find a specific user by its name.

Params

  • name string - User name to search for.

Returns: User - The user found or undefined.

mumbleClient.userBySession(id)

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.

mumbleClient.users()

Returns all users currently connected to the server.

Returns: Array.<User> - Users connected to the server

mumbleClient.connection

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.

mumbleClient.ready

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.

mumbleClient.rootChannel

The server root channel.

mumbleClient.user

The current user.

Event: 'channel-*'

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' );
});

Event: 'channel-create'

Emitted when a new channel is created.

Params

  • channel Channel - The new channel.

Event: 'error'

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.

Event: '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.

Event: 'user-*'

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' );
});

Event: 'user-connect'

Emitted when a new user connects to the server.

Params

  • user User - The connected user.
⚠️ **GitHub.com Fallback** ⚠️