Sharing models via Socket.io

I think if the files do not have textures you can send the JSON via webSocket and then add them like this:

BABYLON.SceneLoader.ImportMesh("", ASSETS_URL, "data:" + jsonContent, scene, (    meshList, particleSystems, skeletons) => {
...
}

This is a special syntax that is not very well documented (it’s not really a data URL), but it works! We use a similar approach with very good results. I think the size of typical babylon (JSON) files won’t be a problem at all for the websocket server. This approach is good if you reuse the same textures anyways, but not so good if you need to send new textures, for the reason @gbz gave.

1 Like