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目录下是示例案例,每一个目录是一个独立的项目,会不断添加。

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
