Help with ruby callbacks (Ice & Murmur)

How to do...

Help with ruby callbacks (Ice & Murmur)

Postby Nyma » Wed Aug 10, 2016 10:52 pm

Hi,
I'm somewhat new at coding but my goal is to let ruby do some stuff when something specific happens on the server (e.g. a user joined)

I could query all users every x seconds like
Code: Select all
meta.getServer(1).getUsers
but i would rather use callbacks (like this).



For simplicity I tried to get the meta callback working (server starts/stops) but I even failed that 'simple' task. :(
I mostly used this python code as guidance but I can't seem to 'translate' the following code to ruby:

Code: Select all
class MetaCallbackI(Murmur.MetaCallback):
    def started(self, s, current=None):
        print "started"

    def stopped(self, s, current=None):
        print "stopped"

adapter = ice.createObjectAdapterWithEndpoints("Callback.Client", "tcp -h 127.0.0.1")
metaR = Murmur.MetaCallbackPrx.uncheckedCast(adapter.addWithUUID(MetaCallbackI()))
adapter.activate()
meta.addCallback(metaR)


I googled a lot the past week but I'm at my wit's end at how to implement even the adapter. :|
Any help on how to do it in ruby would be greatly appreciated. :)
Nyma
 
Posts: 1
Joined: Wed Aug 10, 2016 9:51 pm

Return to Usage

Who is online

Users browsing this forum: No registered users and 1 guest

cron