Giter VIP home page Giter VIP logo

Comments (1)

zhaoye avatar zhaoye commented on June 3, 2024

在当前版本的基础上添加了官方的 websocket inject 示例脚本,启动时通过 -s 指定了该脚本。通过 log 可以打印出 websocket 信息,但是平台上 Inspector 和 Inspector Pro 都没有 websocket 信息,请问下能否支持 ws/wss 这类协议?或者能否提供一点修改思路,能够让 ws:// 被录制?十分感谢


简单的介绍一下思路:
可以参考插件开发相关的文档。实现一个自定义的ws服务,该服务上的数据可以作为事件写入Lyrebird eventbus。这样就可以在Inspector Pro上看到了。


插件开发相关文档

https://meituan-dianping.github.io/lyrebird/develop/plugin.html


向eventbus发送消息的方法

import lyrebird
lyrebird.publish

方法说明:

def publish(channel, event, *args, **kwargs):
"""
发送信号
:param signal: 信号,包含lyrebird, overbridge, android, tracking, perf, hunter
:param sender: 信号发送者标识
:param kwargs: 事件数据
:return:
"""
# context.application.event_bus.publish(channel, event)
application.server['event'].publish(channel, event, *args, **kwargs)


订阅eventbus中指定消息的方法

import lyrebird
lyrebird.subscribe

方法说明:

def subscribe(channel, func, *args, **kwargs):
"""
订阅信号
:param signal: 信号,包含lyrebird, overbridge, android, tracking, perf, hunter
:param func: 响应事件的回调函数
:param sender: 信号发送者标识
"""
# context.application.event_bus.subscribe(channel, func)
application.server['event'].subscribe(channel, func, *args, **kwargs)


@iwakura-lain 希望能帮到你

from lyrebird.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.