蓝莺开发者
Web & Mini ProgramiOSAndroidC++Server API

flooim#

flooim#

flooim.flooim(config) ⇒ object#

初始化SDK

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

ParamTypeDescription
configobjectSDK初始化设置
config.appidstringAPPID
config.wsboolean连接地址前缀是否为ws/wss: true - 连接地址前缀为ws或wss, false - 连接地址前缀为http/https
config.autoLoginboolean是否自动登录
config.dnsServerstring | undefinedDNS服务器地址, 可以不设置,默认为 https://dns.lanying.chat/v2/app_dns
config.logLevelstringSDK的日志等级, 默认为debug, 取值为 debug、info、warn、error 或 off, 其中off为不打印日志。

Example

const config = {
// dnsServer: "https://dns.lanying.chat/v2/app_dns",
appid: "YOUR_APP_ID",
ws: false, // uniapp版需要设置为true, web版需要设置为false
autoLogin: true
};
import flooim from 'floo-3.0.0';
const im = flooim(config);
{% lanying_code_snippet repo="lanying-im-web",class="",function="flooim" %}{% endlanying_code_snippet %}

flooim.login(opt)#

登录

Kind: static method of flooim

ParamTypeDescription
optobject
opt.namestring用户名
opt.passwordstring密码

Example

{% lanying_code_snippet repo="lanying-im-web",class="im",function="login" %}{% endlanying_code_snippet %}

flooim.qrlogin(opt)#

二维码登录

Kind: static method of flooim

ParamTypeDescription
optobject
opt.user_idnumber用户ID
opt.passwordstring密码

Example

{% lanying_code_snippet repo="lanying-im-web",class="im",function="qrlogin" %}{% endlanying_code_snippet %}

flooim.tokenLogin(user_id, token)#

token登录

Kind: static method of flooim

ParamTypeDescription
user_idnumber用户ID
tokenstringToken

Example

{% lanying_code_snippet repo="lanying-im-web",class="im",function="tokenLogin" %}{% endlanying_code_snippet %}

flooim.idLogin(opt)#

使用用户ID和密码登录

Kind: static method of flooim

ParamTypeDescription
optobject
opt.user_idnumber用户ID
opt.passwordstring密码

Example

{% lanying_code_snippet repo="lanying-im-web",class="im",function="idLogin" %}{% endlanying_code_snippet %}

flooim.isLogin() ⇒ boolean#

是否已登录

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

{% lanying_code_snippet repo="lanying-im-web",class="im",function="isLogin" %}{% endlanying_code_snippet %}

flooim.on(options, ext)#

事件监听

Kind: static method of flooim

ParamTypeDescription
optionsEvent | Object.<Event, EventCallback>可以为事件名,也可以为事件名和事件回调
extEventCallback | undefined事件回调,只有options为事件名时需要设置

Example

const im = flooim(config);
im.on('event', (ret) => {
   //do something with ret
 })
 // or
im.on({
   eventName: (ret) => {
     //do something with ret
   },
   ...
 })
{% lanying_code_snippet repo="lanying-im-web",class="im",function="on" %}{% endlanying_code_snippet %}

flooim.off(options, ext)#

取消监听

Kind: static method of flooim

ParamTypeDescription
optionsEvent | Object.<Event, EventCallback>可以为事件名,也可以为事件名和事件回调
extEventCallback | undefined事件回调,只有options为事件名时需要设置

Example

const im = flooim(config);
 im.off('events', (ret) => {
   //do something with ret
 })
 // or
 im.off({
   eventName: (ret) => {
     //do something with ret
   },
 ...
 })
{% lanying_code_snippet repo="lanying-im-web",class="im",function="off" %}{% endlanying_code_snippet %}

flooim.logout()#

退出账户

Kind: static method of flooim
Example

{% lanying_code_snippet repo="lanying-im-web",class="im",function="logout" %}{% endlanying_code_snippet %}

flooim.setLogLevel(logLevel)#

设置日志等级

Kind: static method of flooim

ParamTypeDescription
logLevelstringSDK的日志等级, 默认为debug, 取值为 debug、info、warn、error 或 off, 其中off为不打印日志。

Example

{% lanying_code_snippet repo="lanying-im-web",class="im",function="setLogLevel" %}{% endlanying_code_snippet %}
自动生成的 API 内容,仅在必要位置补充精简的 AI 解释。