using shared pointer to let connection object live until the handler finished. should solve #8 TODO: remove most of the debug stuff and add a check if calling send on a closed websocket connection also causes problems