MeepoPS-lightweight Socket service

Source: Internet
Author: User
MeepoPS-lightweight Socket service MeepoPS is the abbreviation of Meepo PHP Socket. It is designed to provide efficient and stable multi-process SocketService developed by pure PHP.

MeepoPS allows you to easily construct online real-time chats, instant games, video streaming media playback, RPC, real-time monitoring, and scenarios where you originally used HTTP interfaces/scheduled tasks.

Summary:
  • Development Language: PHP5.3 or later

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

  • MeepoPS must be installed with the PCNTL library of PHP.

  • MeepoPS is positioned as a plug-in. Not only can it run independently, but it can also be attached to ThinkPHP, CodeIgniter, YII, and other MVC frameworks.

  • MeepoPS is a lightweight multi-process, high-performance, high-availability, high-concurrency, distributed Socket service, secure and stable. Code maintenance on GitHub, open source code, permanent free.

  • MeepoPS is built from pure PHP and the code is concise and elegant. The best language to do more things!

  • Without complex code and new syntax, you can directly call the native PHP language.

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:
  • Most PHP applications are deployed on Linux servers. Therefore, 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 operating systems to start MeepoPS.

  • Windows users can install virtual machine software such as VirtualBox and Vmware to run MeepoPS.

  • Multi-process and signal processing rely on the PCNTL library of PHP. MeepoPS depends on PCNTL in depth. Therefore, the PCNTL library must be installed. even if you only start one MeepoPS process, you still need to install PCNTL. How to install:

    PHP Manual-install PCNTL

  • For large-scale access, we recommend that you install the PECL extension Libevent of PHP, but this is not necessary. Libevent performs well in scenarios with high connections. How to install: PHP Manual-Libevent installation. As of, PHP's official Libevent extension does not support PHP7. the Libevent installation method under PHP7 is: Libevent branch of PHP7.

  • The default listening link is the Select round robin mechanism. PHP's Select round robin mechanism can only listen to a maximum of 1024 links. To break this restriction, either install Libevent or use -- enable-fd-setsize = 2048 to re-compile and install PHP.

Quick start:

Server usage:

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

Start a common terminal:
1. start: Enter "php demo-telnet.php start" in the command line ". 2. status: command line input "php demo-telnet.php status ". 3. smooth completion: Press "ctrl + c" after startup. 4. force End: Enter "kill-INT 'cat/var/run/meepo_ps/meepo_ps_master.pid" 'in the command line "'.
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: Enter "php demo-telnet.php stop" in the command line ". 4. force stop: command line input "php demo-telnet.php kill ". 5. force End: Enter "kill-INT 'cat/var/run/meepo_ps/meepo_ps_master.pid" 'in the command line "'.
DEMO:
1. for the method of using Telnet-based server, see demo-telnet.php.2. if the HOST started on the server is 0.0.0.0, the client can be an external HOST or a local HOST. the local HOST can be 127.0.0.1 or localhost.3. if the server starts 127.0.0.1/localhost, the client cannot be an external HOST.
Client usage: Telnet:
The client can use a telnet client, for example, telnet 127.0.0.1 19910.
Write code:
The client can be implemented through a Socket in the programming language. For more information, see Test/test_client.php.
A glimpse:
  1. MeepoPS/config. Ini is the configuration file of MeepoPS. And php. Ini in the same format, ";" is the annotation.

  2. MeepoPS/index must be introduced. Php file. The use of MeepoPS is from require_once 'meepops/index. Php.

  3. Files in the MeepoPS/Api/directory are interfaces exposed to users. Interface files need to be instantiated. the use of MeepoPS is centered on objects after the interface files are instantiated. Input the HOST and port of the listener during instantiation.

  4. MeepoPS triggers the business logic you set using a callback function. For example, when a new link is added, the system calls back the set "Hello world". if a link sends a message "PING", the system calls back the set return message "PONG ".

  5. MeepoPS can start multiple instances, and each new interface class file is instantiated once.

  6. MeepoPS not only instantiate multiple interface class files, but also instantiate the same interface class file multiple times. For example, three instances are started, listening to ports 19910,199 11 and 19912 respectively.

  7. After instantiating the interface class file and making relevant settings, call \ MeepoPS \ runMeepoPS () to start MeepoPS.

  8. All code after \ MeepoPS \ runMeepoPS () will not be executed.

Example:

The Example directory is an Example case. Each directory is an independent project and will be added continuously.

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.