dunglas / mercure

🪽 An open, easy, fast, reliable and battery-efficient solution for real-time communications
https://mercure.rocks
GNU Affero General Public License v3.0
3.98k stars 296 forks source link

[INFO] Is a PHP version of the Hub in the plans? #9

Closed Aerendir closed 6 years ago

Aerendir commented 6 years ago

I've read the specification and it seems really promising.

I don't know Go, so I'd like to know if a PHP version is planned or not.

Thank you!

dunglas commented 6 years ago

Hi @Aerendir,

Unfortunately, PHP is not very well suited to handle persistent connections. Projects like React PHP or RoadRunner may allow to implement a proper hub, but they will be less efficient than Go (or Rust, or C) anyway. PHP FPM and mod_php are definitely not adapted.

Also, the Go hub (and, actually, the protocol itself) has been designed from the ground to be very easy to use from PHP, or from serverless architectures. For instance, here is how it looks to integrate the Go hub (or any other hub implementation) with Symfony: https://github.com/symfony/symfony/pull/28877

As the hub is a standalone component, I'm not sure that the language it is written in matter (developers don't have to deal with its code directly, everything pass through its web API).

That being said, I would be very happy to help if someone want to implement a hub in pure PHP.

Aerendir commented 6 years ago

Ok, thank you for your very clear explanations.

I've seen the PR you linked: that was my starting point to discover Mercure! :)

I'll give it a try (maybe I have a use case), but first I need to better understand where to host the hub (probably I will use the Docker image)... Not something I will do in next days, unfortunately. But something I will do for sure...

In the meantime, thank you again for your answer!