How to send a long socket link to a remote server with workerman as a client under thinkphp5.1

problem description

how to send a long socket link to a remote server with workerman as a client under thinkphp

the environmental background of the problems and what methods you have tried

there is no AsyncTcpConnection class in server encapsulated by thinkphp5.1

related codes

/ / Please paste the code text below (do not replace the code with pictures)
/ *

  • Worker Controller extension Class

* /
abstract class Server
{

protected $worker;
protected $socket   = "";
protected $protocol = "http";
protected $host     = "0.0.0.0";
protected $port     = "2346";
protected $option   = [];
protected $context  = [];
protected $event    = ["onWorkerStart", "onConnect", "onMessage", "onClose", "onError", "onBufferFull", "onBufferDrain", "onWorkerReload", "onWebSocketConnect"];

what result do you expect? What is the error message actually seen?

how can I call the AsyncTcpConnection class to send a remote link as a client
need to maintain a persistent connection

Php
Jun.14,2022

do not understand the functions that need to be implemented.
if you are just sending socket data, you can simply use php to create a socket connection to send it.

if you want to call workerman on the web side to connect to a remote socket server, you might as well open a http service directly from the socket server. Because the web side itself is a short connection. It ends when the http request clicked by the user ends.

if the remote server http service is inconvenient, run a client locally with the wokerman daemon, and the web side uses the http service invocation client to send the socket request. This actually depends on the client of wokerman to maintain long links

AsyncTcpConnection is under the vendor/workeman/Connection folder, namespace Workerman\ Connection\ AsyncTcpConnection

Menu