icomet 使用

简介

  • 一个消息推送中间件
  • 高并发
  • 使用简单

安装和运行

wget --no-check-certificate https://github.com/ideawu/icomet/archive/master.zip
unzip master.zip
cd icomet-master/
make
./icomet-server icomet.conf
./icomet-server icomet.conf -s stop

使用

  • curl demo
//订阅
curl -v "http://127.0.0.1:8100/stream?cname=12"
//推送
curl -v "http://127.0.0.1:8000/push?cname=12&content=hi"
  • python demo test.py
#coding=utf-8
import pycurl

class Test: 
  def body_callback(self, buf):
    if  buf!="" :
      print buf#此处为接受到数据后的逻辑处理 略。。 

if __name__ == "__main__":   
  url = 'http://127.0.0.1:8100/stream?cname=12'  
  t = Test()
  c = pycurl.Curl()
  c.setopt(c.URL, url) 
  c.setopt(c.WRITEFUNCTION, t.body_callback)
  c.perform()
  c.close() 

其他

如考虑安全等因素,可在nginx做一次安全认证。

你可能感兴趣的:(icomet 使用)