Hello,
I am interested in reading a speckle stream with JavaScript, i.e. fetching the data found in the stream and being able to use it elsewhere on my website.
The JavaScript SDK (Introduction | Speckle Docs) seems to be about displaying 3D geometries within the browser. I am only interested in receiving the “raw” data, is this possible?
The easiest way to get your hands on the data in JS is to start first with the GraphQL API and then perhaps the REST API.
These will be using your web-request library of choice or native fetch.
With these, you will be able to query both the contents of streams and commits and also then address specific objects.
My personal preference is to use the ObjectLoader package. This is part of the the SpeckleServer repo, but is also available separately from npm @speckle/objectloader
I have run npm init in my base folder, then npm i @speckle/objectloader, after which I added import objectLoader from '../node_modules/@speckle/objectloader' to the top of my JS file.
I am met with the following error when loading the website:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.
point us to a minimal repo and we’ll sort it for you! it’s horrible to debug this otherwise (we don’t know what build steps you have, if any, and if they need to be there!).