how to pass objects in sockjs connection? -
i want send objects between client , server. however, when seek pass object, find unable utilize (values undefined).
to around this, passing object through connection string using
json.stringify @ source
and
json.parse @ destination
this working far worried inelegant solution , when start working complex object (graphics objects etc), end in bad place.
is there native way in sockjs working objects?
thanks.
using network, transferred in binary form 0/1. regardless of info (image, json, string, audio, video, etc..).
the process of converting 1 form called serialisation/deserialisation. websockets default back upwards binary , text based messages. text utf-8, overkill send images in representation of characters text, or base64 not best way require more 1 conversion.
for binary type of info (images, audio, video) should sent binary (blobs), , strings should sent text.
json - text based human readable format , parsers pretty fast today "ok" stringify , parse send around. if there actual problem performance atm, need address logic info protocol here, consider using protobuff or bson send in more efficient way info around.
but should not worry on stage of development. way improve work on real problems.
object sockjs
No comments:
Post a Comment