Ice and Ruby. How to create a proxy object

Ice/DBus, Web-Interfaces, Management tools

Ice and Ruby. How to create a proxy object

Postby goozler » Thu Nov 30, 2017 1:00 pm

Hi! Is there anyone interested in using Ice with Mumble? :)

I want to make a simple script that uses callbacks when a user is connected and disconnected. I chose Ruby because I'm most familiar with it. I took an example from GitHub, configure the server and everything looks fine, I get the server version in Ruby.

But I don't understand how to add my custom callback to the server. How to implement that ServerCallback interface in Ruby. I saw examples in JS and Python there is an adapter is created and used to create new objects. For example, in GitHub Mumble repository we have this example https://github.com/mumble-voip/mumble/blob/master/scripts/server/ice/testcallback.py.

But in Ruby I can't find such ice.createObjectAdapter method. I tried other ways but had the message that I need to provide a proxy object and I don't know how to do it.

Could anyone help with that? A single valid example will be enough.

This is the part of the code:

Code: Select all
props = Ice.createProperties
props.setProperty 'Ice.Default.EncodingVersion', '1.0'
idd = Ice::InitializationData.new
idd.properties = props
ic = Ice.initialize(idd)
base = ic.stringToProxy("Meta:tcp -h #{HOST} -p 6502")
meta = Murmur::MetaPrx.checkedCast(base)

raise 'invalid proxy' unless meta

servers = meta.getBootedServers
puts 'Server version:', meta.getVersion[3]

servers.each do |server|
  something = i_cant_get_how_to_create_this
  callback = Murmur::ServerCallbackPrx.uncheckedCast(something) # to pass this
  server.addCallback(callback)
end
User avatar
goozler
 
Posts: 2
Joined: Thu Nov 30, 2017 12:38 pm

Re: Ice and Ruby. How to create a proxy object

Postby goozler » Sat Dec 02, 2017 2:28 pm

I got the answer on ZeroC forum that there is no way to do it on Ruby https://forums.zeroc.com/discussion/46574/creating-callbacks-on-ruby#latest.

I made what I wanted on Python and this topic might be closed.
User avatar
goozler
 
Posts: 2
Joined: Thu Nov 30, 2017 12:38 pm


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest