A friend want to do the Android version of the Instant messaging app, just for PHP will be some, want to ask everyone PHP suitable for instant messaging service side? What are the pros and cons?
Reply content:
A friend want to do the Android version of the Instant messaging app, just for PHP will be some, want to ask everyone PHP suitable for instant messaging service side? What are the pros and cons?
To be honest, there are some reluctance to use the traditional PHP only for instant messaging. PHP has no advantage in dealing with dense high concurrency and long connections.
Industry-wide solutions are nodejs to do. But it does not mean that the modified PHP is not competent.
PHP has an extension called swoole can help you achieve this Instant Messenger service, it is said that the QPS has been nodejs. Recommended to understand, and there is a source of instant communication available.
The right can no longer fit.
Phpwebim communication architecture based on Swoole:
Https://github.com/matyhtf/php-webim
demo:http://webim.swoole.com/
1. The server driven by NGINX/PHP-FPM provides HTTP services, such as listening on 80 ports:
The browser accesses http://webim.swoole.com/main.html to obtain the data generated by the nginx/apache+php service.
The WebSocket Service (CLI program) implemented by the 2.PHP Swoole listens to a single port, such as 9503:
The main.html page uses JavaScript to access ws://webim.swoole.com:9503 to get the data generated by the WebSocket service.
This is swoole need to play the ultimate demand ah, this kind of thing, using libevent and pure C implementation Swoole is relatively more appropriate than PCNTL-based Workerman.
There have been similar studies before, but not in depth, http://xmpp.org/xmpp-software/servers/for reference only
Thank Wu faint classmate to help me ask questions, also thank you to provide ideas, I decided to use Workerman try?
If concurrency is not particularly high, you can