简体   繁体   English

在Java SSLSocket和HTML5之间进行通信

[英]Communicating between Java SSLSocket and HTML5

Just a quick question, can I use SSL in html5 with websockets to communicate with my java server that is using SSLSockets? 只是一个简单的问题,我可以将html5和websockets一起使用SSL来与使用SSLSockets的Java服务器进行通信吗?

I have been trying to connect using another java client using ssl sockets, which works, but I have not tried to do it through html5. 我一直在尝试使用使用ssl套接字的另一个java客户端进行连接,该方法可以正常工作,但是我没有尝试通过html5进行连接。 Is it even possible? 可能吗

For the record, I am using github pages to host my server, and I have a custom domain provided by Namecheap and an SSL certificate from Comodo. 作为记录,我使用github页面托管服务器,并且我拥有Namecheap提供的自定义域和Comodo的SSL证书。

Is it even possible to communicate between java and html5 using SSL? 甚至可以使用SSL在Java和html5之间进行通信吗?

WebSockets are not the same as "normal" TCP sockets but instead a protocol layer on top of TCP. WebSocket与“普通” TCP套接字不同,而是在TCP之上的协议层。 And thus WebSockets over SSL can not communicate directly with SSLSockets. 因此,基于SSL的WebSocket无法直接与SSLSocket通信。 To communicate with WebSockets (with or without SSL) you would need a library implementing the WebSocket protocol . 要与WebSockets(使用或不使用SSL)进行通信,您需要一个实现WebSocket协议

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

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