A WebSocket can work with only one of the formats at any given time.
binaryType property of a WebSocket, you can switch between using blob or
websocket.binaryType = "blob"; // receive some blob data websocket.binaryType = "arraybuffer"; // now receive ArrayBuffer data
The following code snippet shows how to display images sent by a server using WebSockets.
Here is a code snippet for how to send binary data with WebSockets:
websocket.binaryType = ...