问题
Hello I use the following project class:
https://github.com/paragi/PHP-websocket-client
When I try to connect to the websocket I have the following error: Server did not accept to upgrade connection to websocket. and in the variable $ reaponse_header I have ê☻♥Û256
My websocket works fine and the client connection works on a web browser via javascript
I absolutely need to side me to the websocket as a client via php
J'ai le retour suivant:
Variables in local scope (#3):
$address = 'ws://localhost/'
$buffer = 'ê\002\003Û'
$errno = 0
$errstr = ''
$expectedResonse = *uninitialized*
$fragment = ''
$header = 'GET / HTTP/1.1\r\nhost: localhost:9300\r\nuser-agent: websocket-client-php\r\nconnection: Upgrade\r\nupgrade: websocket\r\nsec-websocket-key: TSF0NT1lXT1BM1ZmaW1mMA==\r\nsec-websocket-version: 13\r\n\r\n'
$headers = array ('host' => 'localhost:9300', 'user-agent' => 'websocket-client-php', 'connection' => 'Upgrade', 'upgrade' => 'websocket', 'sec-websocket-key' => 'TSF0NT1lXT1BM1ZmaW1mMA==', 'sec-websocket-version' => '13')
$host = 'localhost'
$host_uri = 'tcp://localhost'
$key = 'TSF0NT1lXT1BM1ZmaW1mMA=='
$keyAccept = *uninitialized*
$matches = array ()
$metadata = array ('timed_out' => FALSE, 'blocked' => TRUE, 'eof' => TRUE, 'stream_type' => 'tcp_socket/ssl', 'mode' => 'r+', 'unread_bytes' => 0, 'seekable' => FALSE)
$pass = ''
$path = '/'
$path_with_query = '/'
$port = 9300
$query = ''
$response = '\n\n\nê\002\003Û\n'
$scheme = 'ws'
$url_parts = array ('scheme' => 'ws', 'host' => 'localhost', 'port' => 9300)
$user = ''
Do you have a solution to the problem?
Regards
来源:https://stackoverflow.com/questions/55262266/websocket-client-with-php