How to transfer data structures between browser and server

In the context of interactive web applications, especially those libraries that use technologies such as websockets, how can we transfer data structures (for example, maps, lists, sets, etc.) between the client browser and the server? The examples I came across only pass strings.

Is it supported randomly depending on the libraries used, or is a more general mechanism available?

+3
source share
2 answers

You can send three things via websocket (from the point of view of the client):

  • Lines
  • Arraybuffers
  • Blobs

Javascript ( ), JSON WebSocket .

WebSocket, ( ), ArrayBuffers Blobs.

1: ArrayBuffer Blob WebSocket .

2: , , . binaryType WebSocket, "arraybuffer" "blob".

3: HISI WebSocket (, iOS Safari), , .

+5

- JSON .

+2

All Articles