Puis-je transmettre un objet entier javascript pour Node.js pour le traitement du serveur?

StackOverflow https://stackoverflow.com/questions/9335701

  •  27-10-2019
  •  | 
  •  

Question

À l'heure actuelle, je sérialiser un grand objet javascript et l'afficher sur le serveur. Ce processus prend trop de temps. Donc, je voudrais passer un objet javascript du client au serveur via Node.js / Socket.IO de sorte que le serveur peut gérer la charge de travail. Il semble que cela ne fonctionne pas. Est-ce possible?

Était-ce utile?

La solution

Where is the slowdown? If the performance issue is related to serialization, then you're faced with the same problem no matter how you communicate with the server - can't ship objects around without serializing them first.

(To send the object over socket.io, first serialize it, then send it across as a string)

Autres conseils

Simple answer, No it is not possible. You are essentially message passing between two distinct systems. The fact that they are both javascript interpreters is irrelevant.

I would suggest serializing and passing parts of the object as changes occur.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top