GithubHelp home page GithubHelp logo

xw0810 / server-sdk-nodejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rongcloud/server-sdk-nodejs

0.0 1.0 0.0 171 KB

Rong Cloud Server SDK in Node.js. Created by @crystaldust.

License: MIT License

JavaScript 100.00%

server-sdk-nodejs's Introduction

The RongCloud Server SDK

Rong Cloud is committed to providing cloud-based instant messaging services for Internet and Mobile Internet developers. It enables developers to quickly integrate instant messaging capabilities with applications without any hardware installation requirements.

The server SDK is a wrapper of all the https API calls, which could be found here

Install

$ npm install rongcloud-sdk

Init

var rongcloudSDK = require( 'rongcloud-sdk' );
rongcloudSDK.init( 'APP_KEY', 'APP_SECRET' );

Usage

rongcloudSDK.user.getToken( '0001', 'Lance', 'http://files.domain.com/avatar.jpg', function( err, resultText ) {
  if( err ) {
    // Handle the error
  }
  else {
    var result = JSON.parse( resultText );
    if( result.code === 200 ) {
      //Handle the result.token
    }
  }
} );

Asking for a xml format response

rongcloudSDK.user.getToken( '0001', 'Lance', 'http://files.domain.com/avatar.jpg', 'xml', function( err, resultText ) {
  if( err ) {
    // Handle the error
  }
  else {
    // Handle the xml string, since Node.JS doesn't provide a native xml object, you have to handle it by yourself.
  }
} );

API Coverage

The SDK covers all of the RongCloud APIs, including:

User

User block

User blackList

Message

Messsage routing

Message history

Group

Chatroom

The SDK API is designed to keep accordant with the http request path, with all the "/" replaced with ".", that is, for the https API:

https://api.cn.rong.io/user/getToken

You can call

rongcloudSDK.user.getToken

Testing

Since most of the time the user won't be using the components for testing(they are async, underscore, mocha, should and xml2js), these components are obtained only in the npm test script( you can see the scripts for testing in package.json), for testing, just run:

$ npm install
$ npm installTestModules
$ npm test

License

MIT

server-sdk-nodejs's People

Contributors

bcho avatar crystaldust avatar ericyangpan avatar jihongwei003 avatar lanceju avatar runfan avatar yunnysunny avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.