Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support separation of Thing and servers and fix the correct meaning of EventLoop #28

Open
8 tasks
VigneshVSV opened this issue Aug 1, 2024 · 0 comments
Open
8 tasks
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@VigneshVSV
Copy link
Owner

VigneshVSV commented Aug 1, 2024

Something that was overlooked and made wrongly while trying to create the correct interface for properties, actions and events;
Generally the additions of endpoints (HTTP) or available resources (ZMQ) to the server is done in a server object.

This is not the pattern in this package, but must be supported soon so that the usage of different components are clear. This is especially true for the HTTP server as the URL and the request methods mapping are additional features of this protocol, compared to ZMQ which can simply serve an object based on the name of the object members.

Possible tasks

  • define how HTTP server will accept endpoints from Things when they work over all three of IPC, TCP and INPROC ZMQ transports. Specifically it is meant that if the Thing is running over INPROC or IPC, we can still import the local object to add its properties, actions and events. However, for TCP the object may be running somewhere else. Nevertheless, implement this add least for IPC and INPROC.
  • add to HTTP server
    • add_property
    • add_action
    • add_event
    • also accepting Thing object directly
      it should accept URL, HTTP methods as part of a tuple. For example:
server = HTTPServer()
server.add_action('/some-action', 'PUT', Thing.some_action)
  • addition of objects to servers should also be support by ZMQ servers. Reason - Currently we do that with EventLoop object, which is the cause of the mistake. Technically, a server may serve one or more objects. The event loop only executes them. Further, the server holds the address that is to be connected by the client. Since we made server address thing instance specific, therefore for each instantiated thing, a new address is necessary, which is mildly contradictory.
  • The way client finds the server may also need adjustment

This code : https://github.com/labthings/python-labthings may serve as reference. See last 10 lines of the example.

@VigneshVSV VigneshVSV changed the title Support separation of Thing and servers and fix the correct meaning of EventLoop Support separation of Thing and servers Aug 1, 2024
@VigneshVSV VigneshVSV added enhancement New feature or request help wanted Extra attention is needed labels Aug 1, 2024
@VigneshVSV VigneshVSV changed the title Support separation of Thing and servers Support separation of Thing and servers and fix the correct meaning of EventLoop Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant