Issue #9: support onConnect