首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >环信API方法介绍

环信API方法介绍

作者头像
陶然同学
发布2023-04-16 15:50:18
发布2023-04-16 15:50:18
9470
举报
文章被收录于专栏:陶然同学博客陶然同学博客

安装

如果你的项目使用Maven构建并且spring boot是2.4.3以上版本,可以在pom.xml中添加下面代码:

代码语言:javascript
复制
<dependency>
    <groupId>com.easemob.im</groupId>
    <artifactId>im-sdk-core</artifactId>
    <version>0.2.5</version>
</dependency>

如果你使用的spring-boot是2.4.3以下版本的,还需要在pom.xml中添加:

代码语言:javascript
复制
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-bom</artifactId>
            <version>4.1.59.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-bom</artifactId>
            <version>2020.0.4</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

准备

在使用Server SDK之前,需要准备环信appkey、Client ID、ClientSecre。

如果你有环信管理后台账号并创建过应用,请先登录环信管理后台,点击 这里,然后到“应用列表” → 点击“查看”即可获取到appkey、Client ID、ClientSecret。

使用

EMService是所有API的入口,可以这样初始化:

代码语言:javascript
复制
EMProperties properties = EMProperties.builder()
        .setAppkey(cliProperties.getAppkey())
        .setClientId(cliProperties.getClientId())
        .setClientSecret(cliProperties.getClientSecret())
        .build();
​
EMService service = new EMService(properties);

根据业务资源,API分为:

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-04-13,如有侵权请联系 cloudcommunity@tencent.com 删除
目录
  • 安装
  • 准备
  • 使用
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档