Websocket arraybuffer refactoring