javascript - How does websocket binary image transport work? -
can please clear misconceptions
note: not using faye just, ws node module , browsers support websockets but, based on answer: sending javascript object through websockets faye
i have 2 questions:
i don't see how html/javascript client side application know 2 put image.. client sent websocket message background image div#div123 (there many locations put requested image). when client receives message server might not original call (for div123) , might response div6 or div158, or might response totaly different call together. normally, when call server; tell query , when sends response sends answer question (so client knows answer for). how sending client raw binary data dealt in same manner?
say have image (width: 164px height: 164px) , base64 encode it, remove "data:image/png;base64," before sending client have (roughly) string of 2900 characters in length.
whereas if image data rbga array (0-255,0-255,0-255,0-255) each pixel 107584=(164*164)*4 long array or 430336=((164*164)*16) characters long string (commas included). can't imagine how long in binary (maybe times numbers 8?).
i've read posts suggest base64 encoding turning binary sounds creating 33% overhead turning more numbers.
i can't imagine how sending binary not heck of lot slower?
Comments
Post a Comment