Added socketEngine and updated BSwitch with a state listener