简体   繁体   中英

Is there a way to get the Response Headers of WebSocket request?

On a Network tab (Chrome browser) we can see a Headers tab.

Further if we have a request list we see General , Response Headers and Request Headers lists.

For example:

General :

Request URL: wss://some.url.com/websocket

Request Method: GET

Status Code: ...

Response Headers :

OWN-KEY-FROM-SERVER: true

etc...


If that was a XMLHttpRequest , we can use getAllResponseHeaders method of xhr, but WebSocket doesn't have something like this according to the WebSocket API.

I need to get from server some trigger and he is inside Responses Headers list.

Maybe somebody know a decision with that.

If using chrome is not the only option for you, then:

I used wireshark to manitor my websocket traffic. It included all the headers and bodies and works perfectly. Just set filter for tcp.port==YOUR_PORT || (websocket) tcp.port==YOUR_PORT || (websocket) and start manitoring.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM