The development history of the modern web of Erlang Cowboy entry reference

Source: Internet
Author: User
Tags representational state transfer

Erlang Cowboy Introduction Reference modern web History

Original:

http://ninenines.eu/docs/en/cowboy/1.0/guide/modern_web/

Let me review the history of Web technology and anticipate future developments. Cowboy is compatible with all of these technologies except http/2.0, a technology that has not yet been formally incorporated into the specification.

The early web

The initial HTTP is used to return the HTML page to the GET request. The original version was http/0.9. http/1.0 defines the Get,head and post methods to send data through a POST request.

The way http/1.0 works is very simple. First establish a TCP connection to the server, then send the request, the service side returns the result, and then closes the connection.

It must be pointed out that http/1.0 is not very efficient. Opening a TCP connection takes a long time, and the loading of various elements on the page slows down. A lot of improvements have been made in recent years to speed up loading. http/1.1

The upcoming http/1.1 adds a keepalive mechanism that allows multiple requests to use the same connection, while also supporting the flow, allowing the body block data to be sent. http/1.1 defines get, HEAD, POST, PUT, DELETE, TRACE, and Connect methods, and recently added patch methods. A number of header definitions have been introduced to improve caching capabilities.

http/1.1 still works the same way as http/1.0, except that connections can be kept for subsequent calls. This allows the client to perform pipeline operations: Multiple requests are sent in a single line, and requests are processed in the same order as they are sent.

REST

http/1.1 's design is influenced by restful style. Rest, the representational state transfer, is a loosely combined architecture of distributed systems. REST defines a convention for restful systems. The system does not abide by this convention is not restful.

REST is a clearly defined customer-service architecture that communicates through resource references. Resources can be positioned and manipulated. The resource has the media type and whether the information can be cached. Hypermedia determines how resources are associated and used. Rest is stateless, and all requests include complete information to perform the action. http/1.1 defines all methods, headers, and grammars that are used to implement a restful system. Rest is commonly used to design Web program APIs that can be used directly in executable code.

XMLHttpRequest

Also known as Ajax, this technique allows JavaScript code on the page to send asynchronous requests to the server. This technology opens the screen of a Web site moving from a static page to a dynamic Web application.

At the bottom, XMLHttpRequest still executes the HTTP request and waits for a response, but the JavaScript script can continue to run until the response arrives, through a predefined callback function notification page. This technology is still the client initiated the request, the service side still cannot actively push the data to the customer, so the new technology has emerged.

Long Polling (long-polling)

The problem with polling technology is that the server cannot push data directly to the client. So the client can only repeatedly make connections, make requests, get responses, and cycle through them. It costs too much.

In order to implement Message queuing and similar mechanisms, when an event occurs, the user must be notified, rather than the user constantly refreshing the page. A typical system is a chat program. Long polling can reduce server load, but clients still can't get feedback from the server in time.

The mechanism of long polling is similar to polling, polling is immediate feedback, and long polling is the server has never returned the response to the customer until an event occurs. After the client receives a response, it initiates another request and then proceeds to the wait state.

You might guess that long polling is a bit like hacking techniques that could lead to some unexpected problems. Indeed, the long polling mechanism does not work well with proxies.

HTML5

HTML5 is the version after HTML4. But HTML5 is the problem of solving dynamic web programs.

HTML was originally used to write a Web site page. But soon people wanted to write more complex, interactive pages that are now called Web applications. such as news reader, browser in the email client, video site.

Because HTML is not enough, people are starting to use their own solutions, such as plugins. It's not perfect, but it's enough for most people.

Finally, there is now a standard way to solve this kind of problem. The browser can play the media on its own. You can draw and notify events. This is HTML5, which is currently in the process of standardization. EventSource

The event source is also known as the server-side send event, which allows the server to push data to the HTML5 program. The event source is a one-way server-to-client communication, and the client has no way to interact with the server except using HTTP. This technique leverages JavaScript objects to create a EventSource that connects to the server, and then, on a http/1.1 connection, events occur to the client through a small protocol.

EventSource is a lightweight solution that supports only UTF-8 encoded text data. The protocol does not allow the use of binary data. One of the most common methods of weight is websocket.

Websocket

Websocket is a protocol over http/1.1 that provides full-duplex client-to-server communication. Communication is asynchronous and can be concurrent. The websocket contains a JavaScript object that establishes a connection to the server and then uses the binary-based protocol to send data between the server and the client.

WebSocket connections can transfer UTF-8 encoded text or binary data. This protocol also supports the Ping/pong mechanism, which allows the server and client to confirm that the connection is available.

WebSocket connections can transfer any type of data, regardless of size, text, or binary. As a result, Websocket is often used for communication between systems.

SPDY

Spdy is a Google-made protocol to reduce page load times. The method is to open the connection to the server and maintain the connection for the next request, while compressing the HTTP header size to reduce the data transfer.

Spdy is compatible with http/1.1 syntax and is actually different from http,spdy using binary frames rather than text-based protocols. Spdy allows the server to send additional responses to requests, including multiplexing of data streams, request prioritization, and HTTP header compression.

Spdy is experimental, but proven to be successful and likely to be the http/2.0 standard. The browser uses Transport Layer Protocol extension negotiation (TLS Next Protocol negotiation) to seamlessly upgrade the HTTP connection to a SPDY connection. Chrome and Firefox now support opening the SPDY protocol by default.

The agreement itself is not perfect and is being http/2.0 in the process of standardization. http/2.0

After http/1.1 for a long time, finally waited for http/2.0. It is based on the Spdy protocol and has been significantly modified. The http/2.0 is a bidirectional asynchronous full-duplex protocol. Scheduled to be completed later in 2014.


The development history of the modern web of Erlang Cowboy entry reference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.