Rayfusion
Rayfusion

Reputation: 27

Can I pass an entire javascript object to Node.js for server processing?

Currently, I serialize a large javascript object and post it to the server. This process takes to long. So, I would like to pass a javascript object from the client to the server via node.js/socket.io so the server can handle the workload. It seems that it does not work. Is this possible?

Upvotes: 1

Views: 1128

Answers (2)

h0tw1r3
h0tw1r3

Reputation: 6828

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.

Upvotes: 1

blueberryfields
blueberryfields

Reputation: 50468

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)

Upvotes: 2

Related Questions