Rantanen / node-mumble

Mumble client in Node.js
MIT License
155 stars 48 forks source link

How do I create a channel and join it? #45

Closed justinmchase closed 9 years ago

justinmchase commented 9 years ago

I'm looking for something like:

var name = 'testing'
client.createChannel(name)
client.on('channel-create', function (channel) {
    if(channel.name === name) {
      client.channel.join(channel)
    }
})
Rantanen commented 9 years ago

Previously this required client.connection.sendMessage usage to send the protobuf messages. Now there is an API for this:

var parent = client.getChannelByName( 'My Channel' );
parent.addSubChannel( 'New channel' );
client.on( 'channel-create', function( channel ) {
  // ...
});
Rantanen commented 9 years ago

(And yes. You still need the channel.name === name, etc.)

justinmchase commented 9 years ago

Perfect thanks! Can I get the root via getChannelByName( null ) ? Or is it just hanging off of client?

Rantanen commented 9 years ago

I'd say use client.rootChannel or maybe getChannelByName( 'Root' ). I'm just assuming root channel is reported with the name of "Root" by the server.

justinmchase commented 9 years ago

I think it's null, I'll figure it out. Thanks.