Monitor / Control the Server

I'm setting up a home server with Raspberry Pi (running resin.io). It has a node.js webserver and runs VirtualHere. What would be the best way to get the status (e.g. connected devices & users) of VirtualHere to node.js?

I see no possibilities using the server, does this mean I would have to run the client on my server just to monitor it?

Thanks for any advice,

Thomas

#2

That is correct, you need to run the client to monitor the server. Then you can use the client-api to get the server status

#3

Ok, that makes sense. I do see that the server provides callbacks, but they seem very limited. In my scenario I would need/want (at least)
- A generic callback for when any device is added/removed to trigger an update of my web gui.
- A way to prevent the client from renaming the server. It exists for devices, but not for the server.

Are any of these on the current roadmap?

Thomas

#4

For the first point:

Poll the API call GET CLIENT STATE and look for differences there (thats how the virtualhere client running in service mode GUI works). It dumps an easy to parse xml document you can use to detect changes

For the second point:

1. Make sure the client is not running
2. Edit the file c:\Users\<username>\AppData\Roaming\vhui.ini
3. Under the [General] section add then entry HideMenuItems=ServerMenu^Rename...
4. Save the vhui.ini file
5. Start the server, now that option will be hidden.

You can actually hide most menu items by just specifying the exact name of the menu item. If there are muliple menu items with the same name (e.g Rename...) then you need to qualify with either ServerMenu^ or DeviceMenu^
e.g

[General]
...
HideMenuItems=ServerMenu^Rename...,Reverse Clients...,Auto-Use all on this Hub
...
#5

Thanks for the info. As I understand it there is no way to "lock" the name on the server, you have to do this for every client. So I'll run a script on the onServerRename callback which instructs the client running on the server to rename the server to what I want it to be. It's a workaround, but should do the trick.

Thomas