更新记录

1.0.0(2024-03-24)

初始化发布


平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.6.8,Android:4.4,iOS:9 × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

概述

XF-SseUTS封装了服务器推送事件(Server-Sent Events),它是一种用于从服务器向客户端推送实时数据的HTML5技术,可以实现ChatGPT打字机效果。

插件接口

createSse

创建SSE连接,并实时监听服务器数据

uni-app项目中(vue/nvue)调用示例:

import { createSse } from "@/uni_modules/XF-SseUTS"

createSse({
  url: '',
  complete: (res) => {
        console.log(res)
  }
});

uni-app x项目(uvue)中调用示例:

import { createSse } from "@/uni_modules/XF-SseUTS";
import { CreateSseOptions } from "@/uni_modules/XF-SseUTS/utssdk/interface.uts";

let options = {
  url: '',
  complete: (res : any) => {
    console.log(res)
  }
} as CreateSseOptions;
createSse(options);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

closeSse

关闭SSE连接

uni-app项目中(vue/nvue)调用示例:

import { closeSse } from "@/uni_modules/XF-SseUTS"

closeSse({
  complete: (res) => {
        console.log(res)
  }
});

uni-app x项目(uvue)中调用示例:

import { closeSse } from "@/uni_modules/XF-SseUTS";
import { CloseSseOptions } from "@/uni_modules/XF-SseUTS/utssdk/interface.uts";

let options = {
  complete: (res : any) => {
    console.log(res)
  }
} as CloseSseOptions;
closeSse(options);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问