Answer the question
In order to leave comments, you need to log in
How to build an event model for connecting different binary applications?
Good afternoon.
There is an application in a compiled language. The application is alive, the process runs in the background and communicates with clients over the network.
It is necessary to add the ability to write extensions for it in scripting languages. It seems to me that the event model would fit very well here. The script simply subscribes to the necessary events and reacts to them. It is desirable that this could be desired without restarting the main application.
But I have worked very little with compiled applications and have little idea how to implement this?
The only option that I see is to pass event-> script address pairs to the application to run. Pass this on the listening port. In principle, the option is not bad, it even allows you to initiate events from the outside.
Who has experience in such things, tell me, is this the right direction? Maybe there are ready-made solutions for this?
Answer the question
In order to leave comments, you need to log in
https://github.com/jeremyong/Selene
You create a static class in your application with event subscription methods and forward it to lua.
There you do something in the style of
App:addListener('<event>', <callback>)
Simply put the scripts in a folder next to the application. When loading, execute all scripts from the folder.
I see an option to embed in your Python application. The extension registers handlers by calling a special python function. When an event occurs, the application pulls the python code that pulls the registered handlers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question