Search code examples
phpweb-servicessocketsserver-push

php server to server push communication


i have 2 servers (A,B) so far B is pulling A for information. Now i am looking for possibilites to push information from A to B.

The push could be over "fire and forget" as B will still be pulling from time to time.

The simplest solution i could think of would be w webservice over HTTP posting information from A to B. Are there any other valid (php) solutions?

How about a socket connection? is this a valid approach for php? Or switching from HTTP to UDP (less overhead?)

Are there any benchmarks you know of?

Thx for your time and help


Solution

  • Assuming pure PHP:

    HTTP POSTing is the simplest solution in my mind.

    With a socket connection, unless you have a socket listening indefinitely on B (I wouldn't even consider this), you'll need A to POST B to set up a socket anyway.

    I think there is probably some benefit to the socket connection if you're transferring large amounts of data, but if not I'd stick to the POST.