美文网首页
icomet 使用

icomet 使用

作者: 中年大叔的日常 | 来源:发表于2017-07-09 15:00 被阅读76次

简介

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

安装和运行

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 使用

      本文链接:https://www.haomeiwen.com/subject/vbvjhxtx.html