add event read/write/error callbacks.