PHP-websocket-client
PHP-websocket-client copied to clipboard
cant connect with wss/::
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
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
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
have you tried example 3?
yes. websocket_open('www.mews.li/ws/connector',443,$headers,$errstr, 10,true)
e
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?
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
"wss://www.mews.li" is a protocol AND an address. "ws.mews-demo.com" would be just an address. Try without specifying the protocol.
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
they state that you should use: "ws.mews-demo.com" The wss:// part is what this package provides. Not an address.