sgcWebSockets supports a wide range of protocols, HTTP/2 is the protocol which is in development right now.
HTTP 1.1 has been the most used HTTP Protocol and wide implemented in server and clients during the last 15 years. But as internet grows, applications and webs growed and the amount of loaded data increased, the shortcomings of HTTP 1.1 became more prominent. Basically one request by connection and duplication of requests.
HTTP 2 has some advantages like:
- Multiplexed: allows to share a single connection for multiple requests
- Header compression: less data to send.
- Server push: server can send to client some resources which thinks will need.
Testing HTTP 1.1
The test is very simple, just call server to get an image 100 times, one by one, so when first finishes, second request is sent and so on
Testing HTTP 2.0
The test is still more simple than with HTTP 1.1, just create http2 component, and call 100 times to get request, there is no need to wait to get a response because responses are dispatched asynchronously when are received by client.
And the winner is...
Most probably you already know which protocol is faster, you can test yourself using the following compiled demo for windows.
NOTE: in the demo, the HTTP1.1 test runs in a secondary thread and HTTP2.0 is asynchronous so it doesn't needs to run in a secondary thread.