rework pub/sub to be type-centric
use constants for event and function id mapping