better client structure for websockets