libubus: add an inline function for socket event handling