acr*_*bia 5 http-1.1 server-sent-events http2
通过HTML5 EventSource对象使用SSE时,请求是否使用HTTP/2多路复用/流水线功能?特别是,不同标签(重新)中的SSE请求是否会使用相同的HTTP/2连接?
我假设,因为SSE基于HTTP/1.1 chunked_encoding技术(AFAIK),但想检查.
是他们会。Chrome 的 http2 标签是探索如何发出 http2 请求的好方法:chrome://net-internals/#http2。
对于 SSE 发出的请求,您应该看到类似以下内容:
HTTP2_SESSION_SEND_HEADERS
--> exclusive = true
--> fin = true
--> has_priority = true
--> :method: GET
:authority: h2.example.org
:scheme: https
:path: /demo_sse.php
accept: text/event-stream
cache-control: no-cache
referer: https://h2.example.org/
accept-encoding: gzip, deflate, sdch, br
accept-language: en-US,en;q=0.8,fr;q=0.6,es;q=0.4
--> parent_stream_id = 0
--> priority = 1
--> stream_id = 7
Run Code Online (Sandbox Code Playgroud)
正如您在此示例中看到的,浏览器在流 id 7 上发送请求,重新使用它必须获取 html 的连接。
| 归档时间: |
|
| 查看次数: |
995 次 |
| 最近记录: |