join and leave event implementation