PHP-websocket-client icon indicating copy to clipboard operation
PHP-websocket-client copied to clipboard

cant connect with wss/::

Open momit-litu opened this issue 3 years ago • 9 comments

Hi dear, I was trying to connect with MEWS socket which host is ''wss://ws.mews-demo.com/ws/connector''. the server must need the keys into cookie. i just added that into headers. but i am getting the error:

Warning: stream_socket_client(): unable to connect to wss://ws.mews-demo.com/ws/connector:443 (Unable to find the socket transport "wss" - did you forget to enable it when you configured PHP?) in C:\xampp\htdocs\PHP-websocket-client\websocket_client.php on line 101

I need a help badly. Thanks.

my code of example.php

momit-litu avatar Aug 16 '21 08:08 momit-litu

Hi Momit-litu without looking at your code, i would guess that the problem is that you use wss:// as protocol. Its not supported yet, by PHP. You should not specify the protocol. Please look at the ssl example3 in the readme. https://github.com/paragi/PHP-websocket-client If the explanation seems unclear, please help me make it better.

Best regards Simon

paragi avatar Aug 16 '21 08:08 paragi

Thank you for the quick response. yes i tried with the ssl option also. but that time i get the following error. i used www.mews.li/ws/connector as the server address elemination the 'wss://", i have also tried with "mews.li/ws/connector" as server adress. but each time i get the following warning

Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\PHP-websocket-client\websocket_client.php on line 101

Warning: stream_socket_client(): unable to connect to ssl://www.mews.li/ws/connector:443 (php_network_getaddresses: getaddrinfo failed: No such host is known. ) in C:\xampp\htdocs\PHP-websocket-client\websocket_client.php on line 101

momit-litu avatar Aug 16 '21 09:08 momit-litu

have you tried example 3?

paragi avatar Aug 16 '21 11:08 paragi

yes. websocket_open('www.mews.li/ws/connector',443,$headers,$errstr, 10,true)

e

momit-litu avatar Aug 16 '21 12:08 momit-litu

does it work with echo.websocket.org and your headers?

it's unlikely that a wss service starts with www. Are you sure about the address?

paragi avatar Aug 16 '21 12:08 paragi

it works with echo.websocket.org

the server address is ok. i have also tried with demo

WebSocketAddress - wss://www.mews.li WebSocketAddress - wss://ws.mews-demo.com

my header cookie keys are also ok i tested. with a http connection with postman

momit-litu avatar Aug 16 '21 13:08 momit-litu

"wss://www.mews.li" is a protocol AND an address. "ws.mews-demo.com" would be just an address. Try without specifying the protocol.

paragi avatar Aug 16 '21 17:08 paragi

https://mews-systems.gitbook.io/connector-api/guidelines/environments

the above 2 addresses are demo and production both. i tried both without protocol through SSL

momit-litu avatar Aug 17 '21 01:08 momit-litu

they state that you should use: "ws.mews-demo.com" The wss:// part is what this package provides. Not an address.

paragi avatar Aug 17 '21 07:08 paragi