Forum > Networking and Web Programming

Network service

<< < (2/4) > >>

1 ) How is the data transfered - what kind of request is generated ? Must you poll and get or is the data pushed to your app ?
  This is not done. At the moment, as I said, in particular web page there is a print button. But we can not use this to print on local printers, also company which developed web part does not want to deal with this ...
   Web company which developed this web app, will cooperate and provide help ...
   They can dump the JSON data somewhere, when print button is pressed, and I can fetch them with my application and then do my stuff with printing the data.
   They can also dump the JSON on to local laptop with javascript ....

2 ) is there any handshake needed ? You must confirm if the data is read and/or printed correct
  All I need is to get somehow info that someone pressed the button "print" then I can trigger some action to get the data.
  I was thinking that I could check for a particular file on disk, which can be I think generated with javascript, when somone clicks the print button, if file is there then I can fetch data ... After I delete the file and wait for new ....


- -What do you mean by "your stuff click a button"?  What is your stuff?

There will be some people responsible to print the  accreditation.
Process is like this.
 - They navigate to web page, where they select particular person for which they want to print the accreditation.
 - They press the print button on web page.
 - This button then somehow handshakesu with local app on laptop, this triggers local app to either go and get the data from web (JSON, XML )
    Or with java script data is dumped to local disk ...

If you want to build a Lazarus application, you can use THTTPClient, with which you can send requests to and receive responses from webserver. Then you can do whatever you want with it.
  - We do not have data locally, it is easy to use already built service from web.

I just need some kind of signal that print button was pressed, after that we are ok ...

The simplest approach might be pressing the button collects related data, produce a JSON file, and email the file to you. Then you'll know that the PRESS button was pressed.  Not sure I'm understanding you correctly.


Thank you all for you help, it is yes a strange case I understand.
I spoke with guys who own the web part.
They said that some tests were made from their side and they are able to contact localhost service with JavaScript.

So process would be like this.
- Print referent uses a print button on web service.
- Json data is generated, and pushed to referents laptop over localhost web service.

So What I would need to do is to make a web service which would listen on local laptop and would consume a Json data from them.
Then This data is parsed and printed - all automatically ....

What you recommend for this? Create a local web service with fpweb?

Regards Matija

I don't understand. localhost is the PC itself that is running any other program, e.g. browser.  Their accessing localhost doesn't mean anything.

Anyway, based on what you said, building a webserver from your side is the easist, I think.

Pressing the PRINT button will do followings:

   1)  collect relevant data
   2)  make a JSON file
   3)  upload the JSON file to your webserver.

Your webserver will receive the file, parse and print it.

Writing such a simple webserver in Lazarus is quite simple. But you have to set it up and run it.


[0] Message Index

[#] Next page

[*] Previous page

Go to full version