replaced end with promise in ws handlers