简体   繁体   English

https网站中的websocket连接错误

[英]websocket connection error in https website

I want to implement basic chat application in php using the websocket and its working fine in my local server and http website but its not working for the https website. 我想使用websocket在php中实现基本的聊天应用程序,并且在我的本地服务器和http网站中可以正常工作,但不适用于https网站。 I have implemented the chat from this Simple Chat using php 我已经使用php实现了此简单聊天中的聊天

In javascript i was connecting to websocket like this 在JavaScript中我像这样连接到websocket

var wsUri = "ws://mydomain:9000/server.php";   
websocket = new WebSocket(wsUri); 

I have used for my https website wss:// instead of ws:// 我已经将我的https网站wss://而不是ws://

And its giving the error in console 并在控制台中给出错误

WebSocket connection to 'wss://mydomain:9000/server.php' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

And if i observe the terminal its giving the error like " socket_getpeername() : unable to retrieve the peer name[107] Transport endpoint is not connected " 而且,如果我观察到终端,则出现类似“ socket_getpeername() : unable to retrieve the peer name[107] Transport endpoint is not connected的错误socket_getpeername() : unable to retrieve the peer name[107] Transport endpoint is not connected

I googled for the same issue but i didn't get any proper solution. 我用谷歌搜索了同样的问题,但没有得到适当的解决方案。 Please suggest me how can i set the socket options for ssl. 请建议我如何设置ssl的套接字选项。

In this same case we get an error display like below error. 在这种情况下,我们将显示错误消息,如下所示。 "failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR" . “失败:建立连接时出错:net :: ERR_SSL_PROTOCOL_ERROR”

In server page we use socket extensions functions, starts with soket_ . 在服务器页面中,我们使用以soket_开头的套接字扩展功能。

If any know about how to connect ssl with this socket extensions functions.Any clarification my question please post your command. 如果有关于如何使用此套接字扩展功能连接ssl的信息,请澄清您的问题,然后发布您的命令。

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

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