kea

koa-easemob-api

Visit easemob api with koa generator function

Showing:

Popularity

Downloads/wk

7

GitHub Stars

0

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

6

Size (min+gzip)

241.9KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

koa-easemob-api

Visit easemob api with koa generator function.

使用generator方式访问环信API

NPM Version Coverage Status Build Status Downloads Dependency Status License

Install

npm install koa-easemob-api --save

Usage

var easemob = require('koa-easemob-api');

var em = easemob({
  app_key: 'solee#gugu',
  client_id: 'guess',
  client_secret: 'secret',
  org_name: 'solee',
  app_name: 'gugu',
  redis: {
    host: '127.0.0.1',
    port: 6379,
    auth: 'haha1'
  }
});

var resp = yield em.registerUser('username', 'password');
resp = yield em.getUser('username');
resp = yield em.deleteUser('username');
resp = yield em.resetPassword('username', 'newpassword');
resp = yield em.modifyNickname('username', 'nickname');

auth为可选输入参数, 根据您的redis-server是否设置密码再填写.

代码会在调用以上方法的时候,使用em.getToken()方法获取环信的token.

在redis中查看是否已有环信token, 若有则使用该token进行后续服务验证; 若没有则利用输入信息访问环信API获取token并放在redis中.

redis key: easemob:token

ttl: 根据环信返回的过期时间设定

Supported Api

users

  • registerUser 注册环信用户
  • getUser 获取环信用户信息
  • deleteUser 删除环信用户
  • resetPassword 重设环信用户密码
  • modifyNickname 修改环信用户昵称

License

MIT © Bo Li (solee.me)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100