-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Summary
For better game logic debugging and a better view to look into the state. Maybe we can start an electron app when running server. Electron app is essentially node.js + chromium. I believe it has the ability to setup websocket server.
In terms of installation and usage, it shouldn't be something user install with @prisel/server, because this is for development only. It could be a separate package that has peer dependency on @prisel/server. User will install this package as a devDependency.
server can be a event emitter that emits events when start/end/error, user connects/drop, state changes, etc. That means we need to setup electron first, then hook up with server and finally start server. This way electron is able to receive all events since server start.
Electron apps have main process and renderer process. main process runs in node. renderer runs in browser, and these two process communicates through ipc (inter process communication). This means we can't save the state in main process and render it in renderer. Since this is for development only. I don't expect anyone to ever hack it. We can store the state in renderer only. Basically main process only starts server and forwards event to renderer, and renderer does all the state management and rendering.