Allow passing publish callback as last argument of emit