What?
it's web architecture style :
REST defines a set of constraints for how the architecture should behavior.
Constraints:
- Client-server model
- Stateless
- no session information for the client, information transffered should be understandable without context.
- Client to hold the state to process based on the server's reply
- Cacheability
- client can cache responses, responses should define themselves as cacheable or not to prevent clients from providing inappropriate data
- Layered system
- Uniform interface
- Client-side scripting (code on demand)
for Web services :
- a base URI, such as
http://api.example.com/; - standard HTTP methods (e.g., GET, POST, PUT, and DELETE);
- media type: content type
| The basis Of Comparison | WebSocket | REST |
| HTTP | The use of HTTP occurs in the initial connection. | HTTP is a common protocol in RESTful web services. |
| Communication | Bi-directional in nature. | Uni-directional in nature. |
| Nature | Socket-based concept. | Resources based concept, rather than commands. |
| Scenario | Real-time chat application. | Lots of getting request. |
| Dependency | Rely on IP address and port number. | Based on the HTTP protocol and uses HTTP methods to relay data. |
| Cost | The cost of communication is lower. | The cost of communication is comparatively higher than WebSocket. |
| Performance | Better with high loads. | Great for occasional communication. |
| State | WebSocket 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