flooim#
flooim#
- flooim
- .flooim(config) ⇒
object - .login(opt)
- .qrlogin(opt)
- .tokenLogin(user_id, token)
- .idLogin(opt)
- .isLogin() ⇒
boolean - .on(options, ext)
- .off(options, ext)
- .logout()
- .setLogLevel(logLevel)
flooim.flooim(config) ⇒ object#
InitializationSDK
Kind: static method of flooim
Returns: object - flooim object
| Param | Type | Description |
|---|---|---|
| config | object | SDK initialization settings |
| config.appid | string | APPID |
| config.ws | boolean | Whether the connection address is prefixed with ws/wss: ture - the connection address is prefixed with ws or wss; false - the connection address is prefixed with http/https |
| config.autoLogin | boolean | Whether to login automatically |
| config.dnsServer | string | undefined | DNS server address, can be empty, default https://dns.lanyingim.com/v2/app_dns |
| config.logLevel | string | The log level of the SDK, the default is debug, and the value can be debug, info, warn, error or off, where off means no log is printed. |
Example
const config = {
// dnsServer: "https://dns.lanyingim.com/v2/app_dns",
appid: "YOUR_APP_ID",
ws: false, // The uniapp version needs to be set to true, the web version needs to be set to 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)#
Login
Kind: static method of flooim
| Param | Type | Description |
|---|---|---|
| opt | object | |
| opt.name | string | Username |
| opt.password | string | Password |
Example
{% lanying_code_snippet repo="lanying-im-web",class="im",function="login" %}{% endlanying_code_snippet %}
flooim.qrlogin(opt)#
QR code login
Kind: static method of flooim
| Param | Type | Description |
|---|---|---|
| opt | object | |
| opt.user_id | number | User ID |
| opt.password | string | Password |
Example
{% lanying_code_snippet repo="lanying-im-web",class="im",function="qrlogin" %}{% endlanying_code_snippet %}
flooim.tokenLogin(user_id, token)#
token login
Kind: static method of flooim
| Param | Type | Description |
|---|---|---|
| user_id | number | User ID |
| token | string | Token |
Example
{% lanying_code_snippet repo="lanying-im-web",class="im",function="tokenLogin" %}{% endlanying_code_snippet %}
flooim.idLogin(opt)#
Login with user ID and password
Kind: static method of flooim
| Param | Type | Description |
|---|---|---|
| opt | object | |
| opt.user_id | number | User ID |
| opt.password | string | Password |
Example
{% lanying_code_snippet repo="lanying-im-web",class="im",function="idLogin" %}{% endlanying_code_snippet %}
flooim.isLogin() ⇒ boolean#
Logged in or not
Kind: static method of flooim
Returns: boolean - Logged in or not
Example
{% lanying_code_snippet repo="lanying-im-web",class="im",function="isLogin" %}{% endlanying_code_snippet %}
flooim.on(options, ext)#
Event listening
Kind: static method of flooim
| Param | Type | Description |
|---|---|---|
| options | Event | Object.<Event, EventCallback> | Can be event name, and also event name plus event callback |
| ext | EventCallback | undefined | Event callback, only required if options is set as event name |
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)#
Unlisten
Kind: static method of flooim
| Param | Type | Description |
|---|---|---|
| options | Event | Object.<Event, EventCallback> | Can be event name, and also event name plus event callback |
| ext | EventCallback | undefined | Event callback, only required if options is set as event name |
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()#
Log out
Kind: static method of flooim
Example
{% lanying_code_snippet repo="lanying-im-web",class="im",function="logout" %}{% endlanying_code_snippet %}
flooim.setLogLevel(logLevel)#
set log level
Kind: static method of flooim
| Param | Type | Description |
|---|---|---|
| logLevel | string | The log level of the SDK, the default is debug, and the value can be debug, info, warn, error or off, where off means no log is printed. |
Example
{% lanying_code_snippet repo="lanying-im-web",class="im",function="setLogLevel" %}{% endlanying_code_snippet %}