add onconnect hook and connection metadata