pub sub implementation