Add optional callbacks to low-level socket methods and pubsub model methods.