Friday, December 24, 2021

[SysD] RESTful

What?

it's web architecture style : 
REST defines a set of constraints for how the architecture should behavior. 

Constraints:
  1. Client-server model
  2. Stateless
    1. no session information for the client, information transffered should be understandable without context.
    2. Client to hold the state to process based on the server's reply
  3. Cacheability
    1. client can cache responses, responses should define themselves as cacheable or not to prevent clients from providing inappropriate data
  4. Layered system
  5. Uniform interface
  6. Client-side scripting (code on demand)

for Web services :
  1. a base URI, such as http://api.example.com/;
  2. standard HTTP methods (e.g., GET, POST, PUT, and DELETE);
  3. media type: content type

The basis Of Comparison 

WebSocket

REST

HTTPThe use of HTTP occurs in the initial connection.HTTP is a common protocol in RESTful web services.
CommunicationBi-directional in nature.Uni-directional in nature.
NatureSocket-based concept.Resources based concept, rather than commands.
ScenarioReal-time chat application.Lots of getting request.
DependencyRely on IP address and port number.Based on the HTTP protocol and uses HTTP methods to relay data.
CostThe cost of communication is lower.The cost of communication is comparatively higher than WebSocket.
PerformanceBetter with high loads.Great for occasional communication.
StateWebSocket is a stateful protocol.REST is based on HTTP, which is a stateless protocol.

Ref:
https://en.wikipedia.org/wiki/Representational_state_transfer#Architectural_concepts

No comments:

Post a Comment