jmwright / cadquery-gui

An Electron-based GUI for CadQuery
Apache License 2.0
38 stars 3 forks source link

Decouple Front End and Back End with Websockets #8

Open jmwright opened 6 years ago

jmwright commented 6 years ago

Currently the front end and the back end of the app are pretty much the same thing. With the way Electron works it will be tricky to completely decouple them, but a good first step would be to initiate a model build and transport the glTF information back to the viewer via a websocket. Once this infrastructure is in place, it could lead to things later like a presentation mode or even collaborative editing of parts and assemblies.

fragmuffin commented 6 years ago

a good first step would be to initiate a model build and transport the glTF information back to the viewer via a websocket

In a traditional web-server / browser relationship, I believe this would be mostly handled by the client. The only role of the web-socket is to maintain a connection to the server, and to inform the client that there's new information to pull. Then the browser can pull the glTF file via a standard http request.

jmwright commented 6 years ago

Then the browser can pull the glTF file via a standard http request.

Why not just push the new model data as a string through the websocket?

fragmuffin commented 6 years ago

Because:

jmwright commented 6 years ago

I looked into this a little bit tonight and it seems like there's not a clear way to do websockets with an Electron app since it doesn't use a traditional web server framework like Express. More research is needed to see if websockets can be made to work without glitchy behavior.