Implement an on_connect callback