Small refactor for clarity
Attach with websocket and do manual line buffering

This works around the odd byte sequences we see at the beginning of
every chunk when attaching via the streaming HTTP endpoint and a plain
socket.