0

I have a Jetty web server running which accepts POST submissions from clients(currently just a java program that simulates what I want to be an Android device) The client program sends data via POST and the server process each request and stores them in a sql db.

Is this the correct way of communicating with the server? The client just periodically sends data to the server using POST. It does work but are there better ways to send data?

The client dont interact with any Form, the device just sends data to the server, this data could be anything.

  • 2
    What do you need to be "better?" – Robert Harvey Nov 12 '16 at 15:47
  • Im not sure if its the conventional way to send data. – brondy Nov 12 '16 at 15:49
  • What are the benefits that you are going to derive by being "conventional?" – Robert Harvey Nov 12 '16 at 15:49
  • okey lets say I simulate 1000 clients sending 100 request at the same time. Will the server load be better using other methods? I dont know other said methods though. Im wondering if im doing it correctly. It works but still asking – brondy Nov 12 '16 at 15:51
  • The server load will be affected by things that you have not mentioned in your question yet. The mechanism you use to transfer data is not especially meaningful in that context. In particular, the mechanism you're currently using seems perfectly adequate. – Robert Harvey Nov 12 '16 at 15:52
3

The purpose of your POST is to send data to the server. Is it fulfilling that function in a reasonably graceful way?

Nowadays, data is "conventionally" sent between machines on the internet using REST, an architectural style, and JSON, a data exchange format. But a few years ago we were using things like SOAP and XML. Tomorrow, we will be using QUBIT architecture, and REST will seem like old hat.

Do you need REST? Not unless you need the benefits it provides. REST is mostly about defining resources and having machines apply useful verbs to those resources. You can read about that here: http://www.looah.com/source/view/2284

  • Also, such conventions can be met "by accident", without being aware of that. Maybe you are doing REST already. The most important thing is to follow reasonable practises that solve the problem at hand. If these practises are common they might have a name, which helps communicating it to others. – null Nov 12 '16 at 22:32
1

There are many design considerations which might help you decide.

  • Does it need to be reliable? No? Then perhaps a binary UDP protocol is more suitable.
  • Does it require a minimal number of bits, because of power constraints? Perhaps MQTT is suitable.
  • Does it require an extreme amount of connections? Don't use TCP, but UDP.
  • Does it require very low latency? Then setting up connections might be a problem. Consider Websockets.

But, most of these requirements are probably not of your concern. Since you asked, I can safely assume you're in the 'easy' portion of the spectrum. A POST request will be sufficient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.