marcomq / nimview

A Nim/Webview based helper to create Desktop/Server applications with Nim/C/C++ and HTML/CSS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding event system to send async information to client

marcomq opened this issue · comments

Currently, Nimview has some simple interface. There are server side callbacks and these callbacks can send json or strings to the client to be displayed there.
But there is an issue when calling functions that run for a long time on the server. There is only a visible feedback when the function is finished. To have some workaround, it would currently be necessary to create an additional thread which then sets some global variables which then need to be queried via additional request from client to display the information.

Therefore, it seems to be best to send information to the client in some async way - maybe via websockets when using the HttpServer and via webviews "eval" function when using webview.
There should be some additional wrapper that starts these websockets on the client and registers hooks on the client, so the server can call those easily.