moved opening and saving of document to websockets