WebHare community

Hook into republishes

Is there a way to ‘hook’ into a “republishing is done for file X” event?

Can’t seem to find anything for it in code or https://www.webhare.dev/reference/internals/events

It’s publisher:publish.folder.<folderid>

Not documented, so might change in the future. Be very careful with listening for this event on large (hundreds of files) folders, events may come in very fast as each individual publish completion will fire it.

Hmm should this work with the frontend implementation?

    this.eventsConnection = new EventServerConnection({ url: "http://localhost:8000/wh_events/",
                                                        log: true
                                                      });
    this.eventsConnection.on('data', (event) => this.onBroadcastData(event));
    this.eventsConnection.setGroups(["publisher:publish.folder.25115"]);

This works fine for any custom events, but I can’t get it to pick the republish event.

Or is it because the publisher version doesn’t use BroadcastEvent but

  eventmgr->RegisterInterest("publisher:publish.folder." || fol);

its because the eventserver only sees events broadcasted to wh:eventserver. unauthenticated clients being able to listen in on any event would be an issue

Yeah, I can imagine.

Solved it by creating a managed task that republishes and uses WaitForPublishCompletion to BroadcastEvent a custom event, which gets picked up by the frontend.

Seems to work nicely.