简体   繁体   English

如何在Javascript中访问Websocket响应头?

[英]How to access Websocket Response Headers in Javascript?

I need to access the response header from a javascript websocket connection. 我需要从javascript websocket连接访问响应头。 Is there any way to access these response header? 有没有办法访问这些响应标头? Or at least the response code? 或者至少是响应代码?

I only have access to the event of onclose, onerror, onopen with a few (unusable - for my purposes) properties! 我只能访问onclose,onerror,onopen的事件,有一些(无法使用 - 用于我的目的)属性!

You can't. 你不能。 There is no functionality for that at the moment. 目前没有任何功能。 The point of WebSockets is not HTTP communication. WebSockets的重点不是HTTP通信。 HTTP is only used for the handshake. HTTP仅用于握手。

https://developer.mozilla.org/en-US/docs/Web/API/WebSocket https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用JavaScript访问缓存响应标头 - Access cache response headers with JavaScript Javascript Image - 访问响应头 - Javascript Image - access headers in response 如何在JavaScript中的Websocket创建中发送自定义标头? - How to send custom headers in websocket creation in javascript? CORS响应标头如何阻止浏览器JavaScript访问响应对象? - How do CORS response headers prevent browser javascript to access response object? 如何使用javascript访问AJAX未发送的HTTP响应标题? - How to access the headers a HTTP response that you didn't send by AJAX using javascript? 如何将自定义标头从JavaScript WebSocket客户端发送到服务器? - How to send custom headers from JavaScript WebSocket client to the server? 如何使用 PHP 或 JavaScript 获取客户端响应标头? - How to get client response headers with PHP or JavaScript? 有没有办法获取WebSocket请求的响应标头? - Is there a way to get the Response Headers of WebSocket request? 如何在Angular 5中使用HttpClient访问响应标头? - How do I access response headers using HttpClient in Angular 5? 如何访问通过管道传递到feedparser的请求的响应标头 - How can I access the response headers of a request that is piped to a feedparser
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM