Param in client-server model

Dear all,

I use param for implementing validated object attributes for network access. The use case is control systems and data acquisition. There was some interest about what code could be made with this.

The basic idea is that, you parameterize an object as usual. The said parameter will become available to a client’s namespace (as a stub, not a copy). The client can read and write the server parameter just like if the parameter was read/written by a local object instance. This is called RPC or remote procedure calls where you run something somewhere, in this case, read or writing an object’s parameter. Its a fairly old concept predating modern web, yet still used currently in many applications where REST API is not compatible or the application domain mandates RPC. I use it for control systems and data acquisition because, unlike a web server, you cannot run many simultanous operations on a hardware from 1000s of requests from 1000s of people. The requests need to be serialiazed and executed one by one.

I offer HTTP-RPC for that, where HTTP becomes the mode of transport. You can now use it with normal HTTP clients like the web browser. On the parameter you can state what is the URL path you need, what are the HTTP methods for read-write-delete. The convention that is slowly coming up as a web standard is to use GET for parameter read, PUT for parameter write and DELETE for parameter value delete. Especially for parameters, it “looks” like REST API. That is advantage one gets by using descriptors.

I forked the param implementation sometime two years back to optimize it for this use case. It was in version 1 at that time. I support the usage of supplying custom getter, setter and deleter like python’s property. Only difference being, the usual logic flow of param before and after setter is followed unlike the normal property. Its the one main change I made compared to dynamic parameters concept in param. I also dont exactly remember now, why I did that. I did make many other changes but its not important philosophically. The logic is still all the same. Most changes are namespace level changes because my package itself is very big, also it needs thread safe operations on parameters and I dont want stuff to get lost in naming mistakes.

These are some noteworthy examples where you can use how param is used:

This is my implementation of the network accessible parameter, called as “Property” (with capital p) to align with Web of Things definitions. (pls google Web of Things if you are interested):

The main additional possibilities on the parameter are:

  • it respects a state machine for parameter write
  • it accepts URL path and HTTP methods
  • it pushes change events when parameter value changes
  • it can write the latest value to a database if requested

Some other examples are:

You can also use my server side for panel based frontend projects for hardware control, see a panel example I made here:

If there are conceptual mistakes, let me know.

1 Like