Component:Ruby bindings

Erik Massop edited this page Nov 4, 2017 · 1 revision


For an example on how to write a client in ruby you can have a look at the euphoria client. If you're new to ruby then you might want to have a look at Why's Poignant Guide to Ruby or Programming Ruby - The Pragmatic Programmer's Guide before you get your hands dirty.


rdoc generated documentation can be found at



require 'xmmsclient'
xmms = nil
    xmms ='client_name').connect(ENV['XMMS_PATH'])
rescue Xmms::Client::ClientError
    $stderr.puts 'Failed to connect to XMMS2 daemon.'


  • xmms is an object of Xmms::Client class (see Connecting section above).
  • res is a return value.


Broadcast is a message that XMMS2 will send to client when something changed. Playback status, new items in playlists, etc.

Sample usage:

xmms.broadcast_quit.notifier do |res|
    # This will not execute immediately.
    # Only when you application receive broadcast_quit broadcast.
    puts 'Server was shutdown.'

Keep in mind that you need to return true or false inside a notifier block. true means you want to receive events of this type in the future. While false means you will not receive events of this type anymore. Ruby will use last calculated value as a result if you don't explicitly specify it which may result in weird error messages.

For information about specific broadcasts see Ruby_bindings/Broadcasts.


TODO: write something

Other queries

Methods in this sections are useful when you want actively query XMMS2 for something (reading song metadata by it's id, etc.).

For information about specific queries see Ruby_bindings/Other queries.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.