meepops--Lightweight Socket Service

Source: Internet
Author: User
Tags call back

Meepops is the abbreviation for Meepo PHP sockets. Designed to provide highly efficient and stable multi-process socketservice developed by pure PHP.

Meepops can easily build online real-time chat, instant games, video streaming, RPC, real-time monitoring, and the use of HTTP interface/timed tasks in the middle of the scene.

Review:
    • Development language: PHP5.3 or more

    • PHP, as the best language, can not only rely on Nginx to develop Web applications, but also to build efficient and stable instant messaging socket applications

    • The minimum operating requirement for Meepops is the PCNTL Library with PHP installed

    • Meepops's positioning is a plug-in. Not only can run independently, but also can be attached to the MVC framework such as Thinkphp,codeigniter,yii

    • Meepops is a multi-process, high performance, highly available, high concurrency, distributed lightweight socket service that is secure and stable. Code maintenance on GitHub, open source, perpetual free.

    • Meepops is built from pure PHP, and the code is simple and elegant. The best language to do more things!

    • Without complex code and new syntax, the native PHP language can be called directly.

Portal:
    • Manual Address: http://meepops.lanecn.com

    • Github:https://github.com/lixuancn/meepops

    • Bug Submission: https://github.com/lixuancn/MeepoPS/issues

    • Weibo: http://weibo.com/lanephp

Meepops official website

Instant Messaging

Statement:
    • The vast majority of PHP applications are deployed on Linux servers, so meepops does not support non-UNIX operating systems (such as Windows). You can use Apple Mac (OS X), CentOS, Ubuntu, Red Hat, Fedora, FreeBSD and other Unix-like operating systems to start Meepops.

    • Windows users can install VirtualBox, VMware and other virtual machine software to run Meepops.

    • Multi-process and signal processing needs to rely on PHP's Pcntl library. Meepops depth relies on pcntl, so the PCNTL library is required to be installed, even if only one process of Meepops is started, Pcntl is still required. How to install:

      PHP Manual-pcntl Installation

    • Under large-scale access, we recommend installing PHP's pecl extension libevent, but this is not required. In the case of high-link numbers, the libevent performance is excellent. How to install: PHP Manual-libevent installation. The 2016-05-06,php official libevent extension does not support Libevent installation method under PHP7,PHP7: PHP7 libevent Branch

    • The default way to listen for links is select polling mechanism. PHP's Select polling mechanism can only listen for up to 1024 links. To break this limit, either install libevent or use--enable-fd-setsize=2048 to recompile and install PHP.

Quick Start:

How to use the service side:

Basic functions and usage are written in demo-telnet.php, which you can use directly.

Normal terminal startup:
1. Start: Command line Input "php demo-telnet.php start". 2. Status: Command line input "php demo-telnet.php status". 3. Smooth end: Press "Ctrl + C" when you start. 4. Force end: Command line input "kill-int ' cat/var/run/meepo_ps/meepo_ps_master.pid '".

Daemon mode startup:
1. Start: Command Line input"php demo-telnet.php start-d".2. Status: Command Line input"php demo-telnet.php Status".3. Smooth end: Command line input"php demo-telnet.php Stop".4. Forced end: Command line input"php demo-telnet.php Kill".5. Forced end: Command line input"kill-int ' Cat/var/run/meepo_ps/meepo_ps_master.pid '".

DEMO:
1. For service-side usage based on the Telnet protocol, please refer to DEMO-TELNET.PHP.2. If the server starts with the host is 0.0.0.0, then the client can be an external machine, which can be native. This machine can be 127.0.0.1, or it can be localhost.3. If the server is started by the host is 127.0.0.1/localhost, then the client is not external machine, can only be native.
How to use the client: Telnet:
Clients can use Telnet clients. For example: Telnet 127.0.0.1 19910
Write code:
The client can be implemented using the socket of the programming language. Refer to Test/test_client.php
Glimpse:
    1. Meepops/config. INI is the meepops configuration file. Adoption and PHP. INI in the same format, ";" As a comment.

    2. Meepops/index must be introduced. PHP files. The use of Meepops is from Require_once ' Meepops/index. PHP ' started.

    3. The files in the meepops/api/directory are the interfaces exposed to the user. The interface class file needs to be instantiated, and the use of meepops is done around the object after instantiating the interface file. The host and port of the listener are passed in when instantiated.

    4. Meepops will trigger the business logic you set up in the form of a callback function. For example, when a new link is added, it will call back the "Hello World" you set up, or if a link sends the message "PING", it will callback the return message "PONG" you set.

    5. Meepops can start multiple instances, each time the new interface class file is instantiated.

    6. Meepops can not only instantiate multiple interface class files, but also instantiate the same interface class file multiple times. For example, three instances were started and 19910, 19911, 19912 ports were monitored.

    7. After instantiating the interface class file and setting it up, call \meepops\runmeepops () to start the meepops.

    8. All code after \meepops\runmeepops () will not be executed.

Example:

The example directory is an example case where each directory is a standalone project that is constantly being added.

meepops--Lightweight Socket Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.