How to set the request header for PHP swoole websocket client

clipboard.png

google

php
swoole:

clipboard.png

clipboard.png

what caused the 400Bad Request error? is it related to the request header? if so, how should it be set?

Jan.25,2022

  • cannot directly use swoole_client to communicate with WebSocket server, swoole_client is TCP client
  • must implement WebSocket protocol to communicate with WebSocket server. You can use PHP WebSocket client
  • provided by swoole/framework .
Menu