How to access Websocket Response Headers in Javascript?

冷暖自知 提交于 2019-12-31 00:44:27

问题


I need to access the response header from a javascript websocket connection. 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!


回答1:


You can't. There is no functionality for that at the moment. The point of WebSockets is not HTTP communication. HTTP is only used for the handshake.

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



来源:https://stackoverflow.com/questions/23011900/how-to-access-websocket-response-headers-in-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!