搜索插件、代码仓与 APP 分类

插件详情v2.2.13

xmpp_plugin

Xmpp 插件,可帮助通过原生通道和原生库(如 Android 的 smack 和 iOS 的 xmppframework)连接到 xmpp

AndroidiOS
近 30 天下载
64
喜欢数
96
Pub 分数
130

安装插件

flutter pub add xmpp_plugin

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

xmpp_plugin 是一个 Flutter 包,通过 Android 和 iOS 上的原生通道连接到 XMPP(可扩展消息与存在协议)服务器,实现实时通信。它利用 Smack 等原生库(Android)和 XMPPFramework(iOS),确保了强大且高效的 Messaging 功能。该插件非常适合需要即时消息、状态检测和安全聊天功能的应用程序。它在 Flutter 与平台特定的 XMPP 实现之间提供桥梁,具有更好的性能,并与现有的 XMPP 基础设施保持兼容。

适合场景

  • 实时聊天应用
  • 存在性和状态跟踪
  • 安全消息系统
  • 与现有XMPP服务器的集成
  • 多平台消息应用

主要特点

  • 通过 Smack 和 XMPPFramework 的原生集成
  • 跨平台支持 Android 和 iOS
  • 安全连接处理
  • 对XMPP服务器协议的支持
  • 轻量且高效的通信

适合对象

  • 使用 XMPP 构建聊天应用的开发者
  • 使用基于 XMPP 的后端服务的团队
  • 需要低延迟消息传递的应用程序
  • 需要原生级别XMPP性能的项目
  • 针对 Android 和 iOS 的移动应用

使用建议

  • 需要原生设置才能实现完整功能
  • 依赖外部 XMPP 服务器
  • 可用的文档有限
  • 可能需要在每个平台上进行额外配置
  • 不适用于非XMPP通信需求

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

xmpp_plugin

status workflow

  1. Connect to the xmpp server
final param = {
      "user_jid":"jid/resource",
      "password": "password",
      "host": "xmpphost",
      "port": "5222",
      "nativeLogFilePath": "filepath",
      "requireSSLConnection": true,
      "autoDeliveryReceipt": true,
      "useStreamManagement": false,
      "automaticReconnection": true,
};

XmppConnection xmppConnection = XmppConnection(param);

await xmppConnection.start(_onError);
await xmppConnection.login();

  1. Send message to one-one chat
await xmppConnection.sendMessageWithType("xyz@domain", "Hi", "MSGID");
await xmppConnection.sendGroupMessageWithType("xyz@conference.domain", "Hi", "MSGID");
  1. Disconnect the xmppConnection
xmppConnection.logout();
  1. Creating a MUC
xmppConnection.createMUC("groupName", true);
  1. Joining MUC
xmppConnection.joinMucGroups(List<String> allGroupsId)

  1. Sending Custom Message
await xmppConnection.sendCustomMessage("xyz@domain", "Hi", "MSGID","customTest");
await xmppConnection.sendCustomGroupMessage("xyz@conference.domain", "Hi", "MSGID","customText");

  1. Sending Delivery Receipt
await flutterXmpp.sendDelieveryReceipt("xyz@domain", "Received-Message-Id", "Receipt-Id");
  1. Adding members to MUC
await flutterXmpp.addMembersInGroup("groupName", List<String> allMembersId);
  1. Adding admins to MUC
await flutterXmpp.addAdminsInGroup("groupName", List<String> allMembersId);
  1. Get member list from the MUC
await flutterXmpp.getMembers("groupName");
  1. Get Admin list from the MUC
await flutterXmpp.getAdmins("groupName");
  1. Get Owner list from the MUC
await flutterXmpp.getOwners("groupName");
  1. Remove members from the MUC
await flutterXmpp.removeMember("groupName", List<String> allMembersId);
  1. Remove admins from group
await flutterXmpp.removeAdmin("groupName", List<String> allMembersId);
  1. Get online member count from group
var onlineCount = await flutterXmpp.getOnlineMemberCount("groupName");
  1. Get last activity of the jid
var lastseen = await flutterXmpp.getLastSeen(jid);
  1. Get the list of my rosters
await flutterXmpp.getMyRosters();
  1. Creating a roster entry
await flutterXmpp.createRoster(jid);
  1. Join single MUC
await flutterXmpp.joinMucGroup(groupId);
  1. Request MAM Messages
await flutterXmpp.requestMamMessages(userJid, requestSince, requestBefore, limit);
  1. Update Typing Status
await flutterXmpp.changeTypingStatus(userJid, typingStatus);
  1. Update Presence Type
await flutterXmpp.changePresenceType(presenceType, presenceMode);
  1. Get Connection status
XmppConnectionState connectionStatus = await flutterXmpp.getConnectionStatus();
  1. Get ErrorResponse Event
void onXmppError(ErrorResponseEvent errorResponseEvent) {
    // TODO : Handle the Error Event
}
  1. Get SuccessResponse Event
void onSuccessEvent(SuccessResponseEvent successResponseEvent) {
    // TODO : Handle the Success Event
}
  1. Get ChatMessage Event
void onChatMessage(MessageChat messageChat) {
    // TODO : Handle the ChatMessage Event
}
  1. Get GroupMessage status
void onGroupMessage(MessageChat messageChat) {
    // TODO : Handle the GroupMessage Event
}
  1. Get NormalMessage status
void onNormalMessage(MessageChat messageChat) {
    // TODO : Handle the NormalMessage Event
}
  1. Get PresenceChange status
void onPresenceChange(PresentModel presentModel) {
    // TODO : Handle the PresenceChange Event
}
  1. Get ChatStateChange status
void onChatStateChange(ChatState chatState) {
    // TODO : Handle the ChatState Event
}
  1. Get ConnectionEvent status
void onConnectionEvents(ConnectionEvent connectionEvent) {
    // TODO : Handle the ConnectionEvent Event
}

Contact

You can reach us via mail(hiren@xrstudio.in) the if you have questions or need support.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。