im_plugin_tencent_web 0.0.5 copy "im_plugin_tencent_web: ^0.0.5" to clipboard
im_plugin_tencent_web: ^0.0.5 copied to clipboard

Platformweb

A Flutter plugin integrating Tencent IM for web, supporting chat and audio/video calls. Uses UI-free access method, providing ready-to-use APIs. Web-only integration.

im_plugin_tencent_web #

A Flutter plugin that inherits from Tencent IM

聊天互动使用:@tencentcloud/lite-chat (无UI)进行集成

音视频通话使用:TUICallEngine (无UI)进行集成

预览示例 #

如果您或您的公司有现成可用的 腾讯IM 即时通讯 服务, 那么您可以点击下面的示例去看看效果。

使用 腾讯IM 即时通讯 的相关参数 登录后就能看到效果啦 🤩🤩🤩🤪

放心登录,别怂,因为这只是示例项目,不会记录任何您的个人资料信息

👉 点击去查看示例效果

🎃🍟😋 如果无法查看,那应该就是当天的免费浏览额度用完了,要不您明天再来? 🎉

使用前准备 #

第一步 #

下载并复制以下文件到项目的 web 目录下

im_plugin.bundle.js

第二步 #

在 web/index.html 的 head之间添加下面的代码

<script src="im_plugin.bundle.js" defer></script>

开始使用 #

初始化IM #

import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';
import 'package:im_plugin_tencent_web/im/event_listener_config.dart';

ImPluginTencentWeb.initSdk(
  sdkAppID: 0,
  eventListener: EventListenerConfig(),
);

可传入的事件列表

登录IM #

import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';

try {
    final imLoginRes = await ImPluginTencentWeb.login(
        userID: '',
        userSig: '',
    );
    print(imLoginRes);
} catch(err) {
    print('登录出错:$err');
}

登出IM #

import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';

try {
    final imLogoutRes = await ImPluginTencentWeb.logout();
    print(imLogoutRes);
} catch(err) {
  print('登出出错:$err');
}

销毁IM #

import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';

try {
  await ImPluginTencentWeb.destroy();
} catch(err) {
  print('销毁出错:$err');
}

发送消息 #

import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';
import 'package:im_plugin_tencent_web/im/create_msg_info.dart';

try {
    /**
     * msgToId              消息接收方的 userID 或 groupID
     * conversationType     会话类型,取值TencentCloudChat.TYPES.CONV_C2C(端到端会话)或TencentCloudChat.TYPES.CONV_GROUP
     * priority             消息优先级
     */
    await ImPluginTencentWeb.sendMsg(CreateMsgInfo createMsgInfo, { Map<String, dynamic>? options });
} catch(err) {
  print('发送消息出错:$err');
}

创建消息参考

1
likes
150
points
103
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin integrating Tencent IM for web, supporting chat and audio/video calls. Uses UI-free access method, providing ready-to-use APIs. Web-only integration.

Repository

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, meta, plugin_platform_interface, scrollview_observer, web

More

Packages that depend on im_plugin_tencent_web

Packages that implement im_plugin_tencent_web