The Http service process actively sends messages to the ws service process.

on the same server ( Linux ), there is a http service built by PHP and a WS ( websocket ) service based on Workerman . How can the http service process actively send messages to this WS service process?

PS: PHP version 5.5.37 workerman version: 3.3.3

Mar.04,2021

in theory, it must be curl to operate. Upgrade to websocket through header to request
only the data to be submitted. This depends on the format of the data to be received by the WS protocol in workerman. I think you can use js to trigger ws to send messages, and then go to the backend log to see what format you receive


workerman documents have


http cannot send messages on your own initiative. Websocket is a new technology derived from this problem


the ws process can open a http interface (Nodejs's socket.io can be used with http if possible) and send the received data to websocket

.

php can directly request the newly opened http interface.

Isn't there an example of being a wsws client in the

workerman document? Refer to the examples in the document

Menu