Closed makenai closed 9 years ago
Agreed.
Especially if we go with an architecture where the server is a generic REST interface to J5, having events come back over sockets would be really keen. So let's say we had an accelerometer, we could register for "data" events:
POST /api/components/myaccelerometer/register/data
Internally, that could do a accel.on('data')
handler which sends events via websockets to the browser, which would route the value to the appropriate blocks, as well as the component representation.
Ended up wrapping everything in electron and using IPC for the native version. The Chrome app version will use native execution. No need for web sockets here as the performance of IPC is quite good.
Nice work @makenai! I haven't used Electron yet, so I'm going to look through at how you're using it.
Electron is pretty neat, and it allows you to package native windows, linux and mac executable. The biggest problem is with using native modules, since it uses Chromium v8 headers instead of the ones that ship with node.
There is a solution called electron-rebuild
in npm that should do it automatically, but I haven't been able to get it to work. Instead I am requiring iojs v1.8 as a stop gap since it uses the same (or a close enough) version of v8.
I think I tried to get sockets working before Makerland, but had some compatibility issues. To solve the problem as quickly as possible, I am sending messages between the client and server using a POST request on '/message'. Using sockets would be much more responsive and real time.