refactor, serve http and ws