Improve use of structured logging in webapi tests.

Avoid using a mix of stdlib logging and structured logging.

Disconnect the websockets handler when stopping the server.

Only send relevant messages over the websocket.