Fabric.js has a feature which allows us to serialize a canvas to a JSON object. In some cases, this may be a lot smaller than the base64 PNG representation of the image, and it might be worth sending this over the network in order to save bandwidth.
See http://fabricjs.com/docs/fabric.Canvas.html#toJSON
This would require changing both the client and server-side javascript to implement.
Client side changes:
- Client would need to convert image to both PNG and JSON, compare the sizes, and send the smallest one (shortest string).
- Upon receiving image data from the server, the client would need to parse whether it's a PNG or JSON and display it appropriately
Server side changes:
- Server image validation would need to be changed to account for the different types of data
Fabric.js has a feature which allows us to serialize a canvas to a JSON object. In some cases, this may be a lot smaller than the base64 PNG representation of the image, and it might be worth sending this over the network in order to save bandwidth.
See http://fabricjs.com/docs/fabric.Canvas.html#toJSON
This would require changing both the client and server-side javascript to implement.
Client side changes:
Server side changes: