1. 安装 icomet
git地址:https://github.com/ideawu/icomet编译:
wget --no-check-certificate https://github.com/ideawu/icomet/archive/master.zip
unzip master.zip
cd icomet-master/
make
服务启动
开启服务
./icomet-server icomet.conf
# or run as daemon
./icomet-server -d icomet.conf
# 关闭服务
./icomet-server icomet.conf -s stop
安装成功测试:
# 开第一个终端
curl -v "http://127.0.0.1:8100/sub?cname=12&seq=1"
# 开另一个终端
curl -v "http://127.0.0.1:8000/push?cname=12&content=hi"
2. 实现长轮询 long polling
(0). 将long-polling.html 放入根目录