Replies: 2 comments
-
Hi Eduardo PHP-websocket-client use HTTP or HTTPS to create a connection, and then upgrade that connection to a websocket. $server = 'echoserver.com'; or If (or when) the websocket protocol gets implemented in PHP, you don't need this package :) Let me know it this solves your issue? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi Simon,
thanks for suggestions.
I have tried a lot until I got it to work.
Now, analysing the two cases I tried (with ws:// and without it), I can see
that your suggestion without ws:// is correct. But why I got different
answers in the two cases?
In the first case, as I said above, with ws:// it was not accepted because
the HTTP protocol is not recognized by PHP and therefore the error "Unable
to find the socket transport "ws" ".
In the second case there was no ws:// and the error was "Connection
refused". This intrigued me a lot, until I questioned my hosting provider.
There was the answer for the problem. The port 53030 i was using was closed
for output no the providers firewall, something that didn't cross my mind.
Thanks for your prompt responses.
Well, now I can only wish you and the whole family, a happy Christmas and a
hopeful 2021.
Best regards,
Eduatdo
Em seg., 21 de dez. de 2020 às 12:21, Simon Rigét <notifications@github.com>
escreveu:
… Hi Eduardo
PHP uses HTTP or HTTPS protocol to create a connection, and then upgrade
that connection to a websocket.
You should not specify the protocol, in the server parameter.
$server = 'echoserver.com';
$port =443;
$ssl = true
$sp = websocket_open($server, $port, $errstr, 10, $ssl)
or
$server = 'echoserver.com';
$port =80;
$ssl = false
$sp = websocket_open($server, $port, $errstr, 10, $ssl)
Let me know it this solves you issue?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD3BQAHVSF6DB75FL44CCS3SV5RYXANCNFSM4VEH4EJA>
.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I created an echo server (I had a lot of trouble making it work because I didn't find anything on the internet, just for socket.io) to have a simple testing tool.
This echo server allows me to compare the results using a javascript client (Browser) and a PHP application using PHP-websocket-client class.
Now, my problem is following:
var ws = new WebSocket('ws://' + host + ':53030/');
the connection is established and write and read works fine.
$server = 'ws://echoserver.com';
$port = 53030;
$sp = websocket_open($server, $port,'',$errstr, 10, false);
NOTE: this is just the code snippet, just to explain.
In this situation, the websocket_open function returns after showing the error [0]-[Unable to find the socket transport "ws" - did you forget to enable it when you configured PHP?].
If I change
$server = 'echoserver.com';
the websocket_open function returns after showing the error [111]-[Connection refused].
I tried to find out a solution for " Unable to find the socket transport "ws" ", without success. I tried to call the PHP function stream_get_transports(), and found out that ws:// nor wss:// are listed.
The question is:
how to resolve this?
Best regards,
Eduardo
Beta Was this translation helpful? Give feedback.
All reactions