MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接
    1. Home
    2. HClO
    3. Topics
    H
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by HClO

    • H

      Solved http这个速度正常吗?
      HTTP API和第三方SDK • • HClO

      3
      0
      Votes
      3
      Posts
      492
      Views

      H

      >>> t=time.time();data=r.get("http://localhost:8080//peekLatestMessage?count=10").text;print(time.time()-t) 2.0292623043060303

      获取消息一次要两秒,发消息也差不多,稍微再多点

    • H

      Unsolved 不懂就问,为什么我的消息上报没反应?
      HTTP API和第三方SDK • • HClO

      1
      0
      Votes
      1
      Posts
      354
      Views

      H

      我的setting.yml文件如下

      cors: - '*' host: 0.0.0.0 port: 8080 authKey: 'INITKEYlOwBjACm' enableVerify: false cacheSize: 4096 enableWebsocket: false report: enable: true # 必须为true groupMessage: report: true # 群消息上报 friendMessage: report: true # 好友消息上报 tempMessage: report: true # 临时会话上报 eventMessage: report: true # 事件上报 destinations: - 'http://127.0.0.1:5000/report' extraHeaders: {} heartbeat: enable: false delay: 1000 period: 15000 destinations: [] extraBody: {} extraHeaders: {} adapterSettings: http: ## http server 监听的本地地址 ## 一般为 localhost 即可, 如果多网卡等情况,自定设置 host: localhost ## http server 监听的端口 ## 与 websocket server 可以重复, 由于协议与路径不同, 不会产生冲突 port: 8080 ## 配置跨域, 默认允许来自所有域名 cors: [*]

      接下来是用flask框架写的服务器端代码

      @app.route('/report',methods=["POST"]) def get_tasks(): if request.method=='POST': print(request.__dict__) return '1'

      flask运行时的提示

      * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

      上报地址应该没错?但不仅控制台没有打印信息,用fiddler抓包也找不到上报的包
      求解惑,万分感谢!

    • 1 / 1