Home > Back-end >  Why use a RESTful, write a core functions and HTTP and TCP each call is bad?
Why use a RESTful, write a core functions and HTTP and TCP each call is bad?

Time:09-30

Find it difficult to design good RESTful or, especially there are many complex business systems,

Why a RESTful and fire? The benefits are all sorts of client are using the same interface and the agreement?

I'm thinking, our business is unified function, such as ServerCore1 ServerCore2... HTTP requests, and then returns a JSON values, call this function inside ServerCoreX to return JSON value is returned to the front end, TCP client's request, also in TCP request to accept the processing function call ServerCoreX returned to the client JSON, but HTTP and TCP request parameters are JSON,

Can not be like this? Requests are JSON data format and return are unified,

Only when the request WEB and C/S of different channels, which also most flexible unification, is that ok?

But the disadvantages of this solution is that I still need to maintain acceptance and management of TCP connections, and RESTful is whatever the client connection is unified by the nginx these agents to maintain, this is the advantage of it, I understand that right?

CodePudding user response:

TCP is a long connection, management up more troublesome.
Restful low coupling, stateless

CodePudding user response:

Before and after the separation, easy to expand, debugging, maintenance, as the upstairs said, restful stateless, low coupling, front and back side can develop at the same time, more efficient, of course it takes some time to design early

CodePudding user response:

reference 1/f, did not dare go out handsome response:
TCP is long connection, management up more troublesome.
Restful low coupling, stateless
with epoll management is bad

CodePudding user response:

reference bandaoyu reply: 3/f
Quote: refer to 1st floor did not dare go out handsome response:

TCP is a long connection, management up more troublesome.
Restful low coupling, stateless
with epoll doesn't have good management


Is a complicated problem, the other is too much to handle, implementation depend on the client's words to upgrade is not friendly,

CodePudding user response:

reference 4 floor did not dare go out handsome response:
Quote: refer to the third floor bandaoyu response:

Quote: refer to 1st floor did not dare go out handsome response:

TCP is a long connection, management up more troublesome.
Restful low coupling, stateless
with epoll doesn't have good management


Is a complicated problem, the other is too much to handle, implementation depends on the client's words to upgrade is not friendly,
that in front of me, a MQTT server? This state will not need our management

CodePudding user response:

MQTT is no problem, can be used to combine a restful use
Such as have update notification by the MQTT distributed, then through the restful drop-down updates,

CodePudding user response:

refer to 6th floor did not dare go out handsome response:
MQTT no problem, can be used to combine a restful use
Such as have update notification by the MQTT distributed, then through the restful drop-down updates,
because restful to design a good few people, so it is to avoid a restful, you also combine the ha ha, that's not complicated

CodePudding user response:

refer to 6th floor did not dare go out handsome response:
MQTT no problem, can be used to combine a restful use
Such as have update notification by the MQTT distributed, then through the restful drop-down updates,
RPC restful instead

CodePudding user response:

See the scene, some can replace the with RPC, RPC has its own advantages, such as small amount of data, embedded or some of these can consider for high traffic demand,
Some, such as an interface for multiterminal, request web client can query.

CodePudding user response:

references 9/f, did not dare go out handsome response:

An interface for multiterminal, what you said is the back-end server is distributed kind?
  • Related