MeepoPS是Meepo PHP Socket的缩写。旨在提供高效稳定的由纯PHP开发的多进程SocketService。
MeepoPS可以轻松构建在线实时聊天,即时游戏,视频流媒体播放,RPC,实时监控,以及原本使用HTTP的接口/定时任务的场景中等。
综述:
-
开发语言:PHP5.3以上
-
PHP作为最好的语言,不仅仅能依靠Nginx来开发Web应用,同时,也可以构建高效稳定的即时通讯类Socket应用
-
MeepoPS的最低运行要求是安装了PHP的PCNTL库
-
MeepoPS的定位是一个插件。不但可以独立运行,也可以依附与ThinkPHP,CodeIgniter,YII等MVC框架中
-
MeepoPS是多进程,高性能,高可用,高并发,分布式的轻量级Socket服务,安全稳定。代码维护在GitHub,开放源码,永久免费。
-
MeepoPS由纯PHP构建,代码简洁优雅。最好的语言,做更多的事情!
-
没有复杂的代码和新生语法,原生PHP语言直接调用即可。
传送门:
-
手册地址: http://meepops.lanecn.com
-
Github: https://github.com/lixuancn/MeepoPS
-
Bug提交: https://github.com/lixuancn/MeepoPS/issues
-
微博: http://weibo.com/lanephp
MeepoPS官网
即时通讯
声明:
-
绝大多数的PHP应用都部署在Linux服务器, 因此MeepoPS不支持非Unix操作系统(例如Windows)。 你可以使用Apple Mac(OS X), CentOS, Ubuntu, Red Hat, Fedora, FreeBSD等类Unix操作系统来启动MeepoPS。
-
Windows用户可以安装VirtualBox, Vmware等虚拟机软件来运行MeepoPS。
-
多进程及信号处理需要依赖PHP的PCNTL库。 MeepoPS深度依赖PCNTL, 因此PCNTL库是必须安装的, 即使只启动一个进程的MeepoPS, 仍然需要安装PCNTL。 如何安装:
PHP手册-PCNTL安装
-
在大规模访问下,我们建议安装PHP的PECL扩展Libevent,但这不是必须的。在高链接数的场景下, Libevent表现优异。如何安装: PHP手册-Libevent安装 。截止2016-05-06,PHP官方的Libevent扩展不支持PHP7,PHP7下的Libevent安装方法: PHP7的Libevent分支
-
默认监听链接的方式为Select轮询机制。PHP的Select轮询机制最多只能监听1024个链接。想要突破这个限制,要么安装Libevent,要么使用--enable-fd-setsize=2048重新编译安装PHP。
快速入门:
服务端使用方法:
基础功能和用法都写在demo-telnet.php,基本您就可以直接用。
普通终端启动:
1. 启动: 命令行输入"php demo-telnet.php start".2. 状态: 命令行输入"php demo-telnet.php status".3. 平滑结束: 启动后按下"ctrl + c"即可.4. 强行结束: 命令行输入"kill -INT `cat /var/run/meepo_ps/meepo_ps_master.pid`".
守护进程模式启动:
1. 启动: 命令行输入"php demo-telnet.php start -d".2. 状态: 命令行输入"php demo-telnet.php status".3. 平滑结束: 命令行输入"php demo-telnet.php stop".4. 强行结束: 命令行输入"php demo-telnet.php kill".5. 强行结束: 命令行输入"kill -INT `cat /var/run/meepo_ps/meepo_ps_master.pid`".
DEMO:
1. 基于Telnet协议的服务端使用方法请参考demo-telnet.php.2. 如果服务端启动的是HOST是0.0.0.0, 那么客户端可以是外机,可以是本机.本机可以是127.0.0.1, 也可以是localhost.3. 如果服务端启动的是HOST是127.0.0.1/localhost, 那么客户端是不能外机,只能是本机.
客户端使用方法:
Telnet:
客户端可使用telnet客户端.如: telnet 127.0.0.1 19910
编写代码:
客户端可借助编程语言的Socket来实现. 可参考Test/test_client.php
惊鸿一瞥:
-
MeepoPS/config。ini是MeepoPS的配置文件。 采用和php。ini同样的格式, ";"为注释。
-
必须引入MeepoPS/index。php文件。 使用MeepoPS都是从 require_once 'MeepoPS/index。php' 开始的。
-
MeepoPS/Api/目录下的文件为暴露给用户的接口。 需要实例化接口类文件, MeepoPS的使用都是围绕实例化接口文件后的对象来操作的。 实例化的时候传入监听的HOST和端口即可。
-
MeepoPS会以回调函数的方式来触发您设置的业务逻辑。 比如新链接加入时会回调您设置的"Hello world", 再比如某个链接发送了消息"PING"时, 会回调您设置的返回消息"PONG"。
-
MeepoPS可以启动多个实例, 每一次的new接口类文件都是一次实例化。
-
MeepoPS不但可以实例化多个接口类文件, 也可以实例化同一个接口类文件多次。 比如启动了三个实例, 分别监听了19910, 19911, 19912端口。
-
实例化接口类文件并进行了相关设置后, 调用\MeepoPS\runMeepoPS()即可启动MeepoPS。
-
\MeepoPS\runMeepoPS()之后的所有代码都将不会执行。
示例:
Example目录下是示例案例,每一个目录是一个独立的项目,会不断添加。

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)