B4J Question simplest way to have optional UI for non-UI app ?

peacemaker

Expert
Licensed User
Longtime User
Hi, All

If a server app is being developed, that must work 24\7 on server, without window-interface, but it needs some settings (periodical manual operations, adjusting...), setup by a user - how simpler\faster to implement the settings user interface ?

Web-app should have documented access, and needs to develop HTML forms code, and make the handlers and classes for them ... maybe is there more simple way for interface ?
 
Last edited:

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
how simpler\faster to implement the settings user interface ?
Jserver allows you to have non ui handlers. What I mean is that a non ui doesn't need to receive and send html.

It can also receive json or even maps and list with b4xserializator.

I would suggest creating another app in any other b4x platform that sends instructions to the app via http.
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Did you mean 2 apps talk via Sockets (MQTT, for ex.) ?
Jserver uses http protocol. You can send any instruction to it. (for example: A post request with httpjob with a json)

But now that you mention it. You can instantiate an mqtt on a background worker and send instructions too.

The first idea is more elegant but any would be okey.
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
+1 jserver with a basic HTML UI. If you need to update config or send instructions to the app you can use a web socket.
 
Upvote 0

jahswant

Well-Known Member
Licensed User
Longtime User
It will be like a WebApp with your embedded server for your tasks. Use the HTML forms to make your configuration
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
WebApp with your embedded server for your tasks
Yes, exactly.
HTML forms to make your configuration
So, is it simpler solution you think ?

Now i'm guessing about B4XSerializator passing a Map with settings parameters that are viewed and edited by a second B4J UI app...
Map with items with the type something like:
B4X:
Type MySetting (Name As String, strValue As String, boolValue As Boolean, numValue As Float, Image() As Byte)
'or even simpler:
Type MySetting (Name As String, Value As String, Image() As Byte)
And name like "boolFlag1" or "strURL1" may help to parse each such setting parameter inside the map...
 
Last edited:
Upvote 0

jahswant

Well-Known Member
Licensed User
Longtime User
Yes this is the simplest solution. You will not need any desktop application for this no ! You will design your html forms and use websockets in your in your server to access data input from a browser
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
What about the idea to pass a new setting to a working non-UI app1 (in any OS - desktop or server) - by another non-UI app2 that is started with CLI-parameters (settings) and then app2 is sending them by Sockets to app1 ?
This looks like the universal solution - any OS can be used for settings.
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
by another non-UI app2 that is started with CLI-parameters (settings) and then app2 is sending them by Sockets to app1 ?
that sound convoluted. if you make your app accept JSON or a simple text with instructions, you could use any terminal with CURL without having to install java.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
you could use any terminal with CURL without having to install java
yes, but for a system operator (that is to be a manager, not Linux user\admin) should be some readable interface, with settings choice and\or entering text...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Not very clear what you want to achieve but my understanding is something similar to my Web API Server and UI Client Apps.

 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
what you want to achieve
Universal (from any OS, desktop or server one) and simplest (for the developer) and clear\readable (for system operator\user) way to read-write the settings of the console non-UI server B4J 24\7 app.

And, it seems, now to me, that it is ... a plane HTML POST-method form from user's web-browser (or extra non-UI CURL app from a server OS). Nothing new and special :)
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
..you can have a second app (b4j,b4a,b4i) that will create "ini" file - and the "main" app can just loading it very some seconds (can also check if the settings are same or different from previous load... just a whole-string check)...

Will be easier interface... but more for local app... not for internet apps...
internet apps and easy creating ....will go with html interface too... with html forms... reading writing an sqlite db...

But... if you want a complicated solution... you can use an MQTT Server (third company may be)... to transfer settings through it ... and have b4x UI... cloud rulez :)
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
but more for local app... not for internet apps...
Why ? For any webserver app:
  • Read the settings from ServletResponse to HTML form (pre-setting the current settings)
  • Writing HTML form fields (new settings) to ServletRequest
MQTT Server
Yes, it's even more universal solution, where any host can read and write settings to any.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Universal (from any OS, desktop or server one) and simplest (for the developer) and clear\readable (for system operator\user) way to read-write the settings of the console non-UI server B4J 24\7 app.

And, it seems, now to me, that it is ... a plane HTML POST-method form from user's web-browser (or extra non-UI CURL app from a server OS). Nothing new and special :)
Doesn't my solution fit?
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Why ? For any webserver app:
  • Read the settings from ServletResponse to HTML form (pre-setting the current settings)
  • Writing HTML form fields (new settings) to ServletRequest
this also complicated :) but yes is a solution too..
 
Upvote 0
Top