Someone can probably give a better answer. As far as I know there are no xquery socket io functions provided with basex. You can write java to do that or you can use an external process that communicates with the mainframe and invoke that process from xquery, among other solutions. If you write java you could look at the basex source to imitate how it uses sockets and/or read about socket io in java. With that you could poll or send and receive data to from the mainframe.
To know if the mainframe connection is connected, I think you can use the admin:sessions() function to see if it is connected or your program that does the io could indicate that it is not connected if it can’t communicate.
If you use xquery and RESTXQ to write the web application, and the same basex instance is communicating with the mainframe then the xquery in your application is already running in the basex server.
For the second task it’s the same idea. You will need to read about how updating works:
http://docs.basex.org/wiki/XQuery_Update
Or, reading this would tell you a lot:
http://docs.basex.org/wiki/Table_of_Contents
Kendall
On 10/18/17, 3:22 PM, "basex-talk-bounces@mailman.uni-konstanz.de on behalf of Dave Day" <basex-talk-bounces@mailman.uni-konstanz.de on behalf of David.Day@duke-software.com> wrote:
Greetings list,
I have an idea of how I want to use Basex, and would like to know if what I am wanting to do will work.
My background is IBM mainframe, so the terminology I use is influenced by that.
I have a server running in an address space on a mainframe. Within that address space are multiple tasks active. I believe the term task is equivalent to a thread in the distributed world.
I would like to have a task initialize when my server comes up and establish a connection to an instance of a Basex server. This task would be responsible for processing requests that come in from the Basex server.
On a browser, I want to have a user connect to an instance of the Basex HTTP server. From the manual, it states that if the HTTP server is started, the client server is started as well. I don't know if this is all one instance of a Basex, or if there are actually two processes that get established. The HTTP server will need to know if the connection has been established between the mainframe and the client server. Is this possible, and if so, how would that be accomplished?
Assuming that the user on the browser needs some information from my mainframe server, is there a mechanism in place to facilitate the HTTP server sending the request to the client server, and the client server sending the request to the mainframe. Would the mainframe have to do a poll of some kind to see if there was data, or can the client server push the request out across the connection?
If the above works, that is, Basex acting as a message broker between a browser and the mainframe, I want to be able to create another connection from another task on the mainframe to the Basex client server as a result of a user request on a browser, have that 2nd task create a new database, and start pushing xml across that 2nd connection. While that new database is being updated from the mainframe, can the user on the browser query the new database to get the most current data?
Regards,
-- Dave Day