flooim

flooim

flooim.flooim(config) ⇒ object

初始化SDK

Kind: static method of flooim
Returns: object - flooim对象

Param Type Description
config object SDK初始化设置
config.appid string APPID
config.ws boolean 连接地址前缀是否为ws/wss: true - 连接地址前缀为ws或wss, false - 连接地址前缀为http/https
config.autoLogin boolean 是否自动登录
config.dnsServer string | undefined DNS服务器地址, 可以不设置,默认为 https://dns.lanyingim.com/v2/app_dns

Example

const config = {
// dnsServer: "https://dns.lanyingim.com/v2/app_dns",
appid: "YOUR_APP_ID",
ws: false, // uniapp版需要设置为true, web版需要设置为false
autoLogin: true
};
import flooim from 'floo-2.0.0';
const im = flooim(config);

flooim.login(opt)

登录

Kind: static method of flooim

Param Type Description
opt object
opt.name string 用户名
opt.password string 密码

flooim.qrlogin(opt)

二维码登录

Kind: static method of flooim

Param Type Description
opt object
opt.user_id number 用户ID
opt.password string 密码

flooim.tokenLogin(user_id, token)

token登录

Kind: static method of flooim

Param Type Description
user_id number 用户ID
token string Token

flooim.idLogin(opt)

使用用户ID和密码登录

Kind: static method of flooim

Param Type Description
opt object
opt.user_id number 用户ID
opt.password string 密码

flooim.isLogin() ⇒ boolean

是否已登录

Kind: static method of flooim
Returns: boolean - 是否已登录

flooim.on(options, ext)

事件监听

Kind: static method of flooim

Param Type Description
options Event | Object.<Event, EventCallback> 可以为事件名,也可以为事件名和事件回调
ext EventCallback | undefined 事件回调,只有options为事件名时需要设置

Example

const im = flooim(config);
im.on('event', (ret) => {
   //do something with ret
 })
 // or
im.on({
   eventName: (ret) => {
     //do something with ret
   },
   ...
 })

flooim.off(options, ext)

取消监听

Kind: static method of flooim

Param Type Description
options Event | Object.<Event, EventCallback> 可以为事件名,也可以为事件名和事件回调
ext EventCallback | undefined 事件回调,只有options为事件名时需要设置

Example

const im = flooim(config);
 im.off('events', (ret) => {
   //do something with ret
 })
 // or
 im.off({
   eventName: (ret) => {
     //do something with ret
   },
 ...
 })

flooim.logout()

退出账户

Kind: static method of flooim

© 2019-2022 美信拓扑 | 官网 该文件修订时间: 2022-07-29 10:38:32

results matching ""

    No results matching ""