带SSL的html5 Websocket [英] html5 Websocket with SSL

查看:236
本文介绍了带SSL的html5 Websocket的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有可能使用https的WebSockets?当切换到https时,我的WebSocket返回一个安全错误,并且与普通的http完美配合...



$ p $ socket = new WebSocket( WS:// my_www:1235\" );

谢谢

解决方案

WebSocket连接通过HTTP或HTTPS握手开始。通过HTTP访问页面时,您可以使用WS或WSS(WebSocket安全:WS over TLS)。但是,当您的页面通过HTTPS加载时,您只能使用WSS - 浏览器不允许降级安全性。


Is it possible to have WebSockets with https? When switching to https, my WebSocket returns a security error and works perfectly with regular http...

socket = new WebSocket("ws://my_www:1235"); 

Thank you

解决方案

The WebSocket connection starts its life with an HTTP or HTTPS handshake. When the page is accessed through HTTP, you can use WS or WSS (WebSocket secure: WS over TLS) . However, when your page is loaded through HTTPS, you can only use WSS - browsers don't allow to "downgrade" security.

这篇关于带SSL的html5 Websocket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆