added feature: now publish returns a promise