Skip to content

sona android介绍

dreambko edited this page Dec 9, 2022 · 2 revisions

项目模块

sona-android 项目包含7个模块

  • sona-room: 主要包含插件管理及使用,component接口定义以及消息component实现
  • sona-audio: 音频component的实现模块
  • mercury: sona房间消息能力的底层支持
  • sona-base: 提供一些通用的基础能力
  • sona-report: 日志处理及上报
  • sona-annotation: 注解处理器注解定义
  • sona-compiler: 注解处理器模块,用于component的生成

项目结构

  1. 各层含义
  • plugin: 定义了每个插件具备的能力,提供外部使用
  • room: 管理与协调plugin、delegate、component,以及提供房间进出入口
  • delegate: 对plugin进行代理,使得plugin只具备什么样的能力,而隐藏所有能力的细节
  • component:聚合各种功能组件,为各种plugin的能力实现提供支撑
  • report: 提供日志处理、事件上报的能力
  1. 房间与插件遵循的规则
  • 每个插件具备两种能力:发送消息&接收消息
  • 插件不暴露其能力的任何细节,做到完全隔离
  • 基础组件通过消息机制抛出消息,插件层通过回调的方式通知业务方
  • 房间只提供进入、离开等基本能力,业务只有注册相应的插件,房间才具备相应的能力
  • 执行除房间具备的能力,需要先从房间获取相应的插件,然后执行插件对应的能力

项目配置

  • demo服务配置
package cn.bixin.sona.demo.constant

object Config {
    const val MERCURY_IP = "x.x.x.x" // 配置长连服务ip
    const val MERCURY_PORT = 8080 // 配置长连服务端口
    const val DEMO_HOST = "http://x.x.x.x" // 配置demo服务host
}
  • sona服务配置 配置sona服务host
package cn.bixin.sona.util;

public interface SonaConstant {
    String API_RELEASE = "http://x.x.x.x"; // 配置sona服务host
}
Clone this wiki locally