Skip to content

Commit

Permalink
Merge branch 'master' of github.com:LinkedDestiny/swoole-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkedDestiny committed Nov 5, 2014
2 parents 746d68a + 726f1dc commit c8837dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 01-环境搭建及扩展安装.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ $server = new Server();
2. 调用**set**函数设置swoole_server的相关配置选项
3. 调用**on**函数设置相关回调函数
关于set配置选项以及on回调函数的具体说明,请参考我整理的swoole文档(
[配置选项](https://github.com/LinkedDestiny/swoole-doc/blob/master/doc/01.%E9%85%8D%E7%BD%AE%E9%80%89%E9%A1%B9.md) )
[配置选项](https://github.com/LinkedDestiny/swoole-doc/blob/master/doc/01.swoole_server%E9%85%8D%E7%BD%AE%E9%80%89%E9%A1%B9.md))

这里只给出简单介绍。onStart回调在server运行前被调用,onConnect在有新客户端连接过来时被调用,onReceive函数在有数据发送到server时被调用,onClose在有客户端断开连接时被调用。
这里就可以大概看出如何使用swoole:在onConnect处监听新的连接;在onReceive处接收数据并处理,然后可以调用send函数将处理结果发送出去;在onClose处处理客户端下线的事件。
Expand Down Expand Up @@ -160,4 +160,4 @@ $client->connect();

(以上两段代码均以上传git,地址:https://github.com/LinkedDestiny/swoole-doc/tree/master/src/01)

下章预告:swoole的task使用以及实例:简单聊天室
下章预告:swoole的task使用以及实例:简单聊天室

0 comments on commit c8837dd

Please sign in to comment.