Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-easemob-api

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-easemob-api

Visit easemob api with koa generator function

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

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)

Keywords

FAQs

Package last updated on 27 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc