Refactoring file sending to arraybuffer websocket mode