Add onBeginSending and onBeginReceiving events.