diuit product overview

Post on 23-Jan-2018

186 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

B2C CHAT APIMOBILE AND WEB MESSAGING, BUILT FOR

DEVELOPERSCreated by / Momo Lee @zxcvbnius

B2C TEAM同事A表示...

同事B表示...

那B2C team到底在做什麼...

一切要從一年前的夏天開始說起...

NO LIMIT

APP SERVER SIDE

APP CLIENT SIDE

Fetching information from databaseP2P tunnel connectionhttp servicefile live streaming...

...

... AND API!!

CHAT APIWebSocket bidirectional, full-duplex communication

+ Node.jsSocket.io

REAL-TIME COMMUNICATION

DEMO

LOGINDiuitMessagingAPI.loginWithAuthToken(new DiuitCallback<JSONObject>() { @Override public void onSuccess(final JSONObject result) { // get session // put your code } @Override public void onFailure(final int code, final JSONObject result) { // put your code } }, authToken);

LIST CHAT ROOMDiuitMessagingAPI.listChats(new DiuitCallback<ArrayList<DiuitChat>>() { @Override public void onSuccess(final ArrayList<DiuitChat> chats) { // if success, return chatArrayList }

@Override public void onFailure(final int code, final JSONObject resultObj) { // if failure, it will return error code and result } });

SEND MESSAGEchat.sendText (String text, ...); chat.sendImage(Image image, ...); chat.sendFile (File file, ...);

AUTHENTICATING USERAuthenticate User On Your Account ServerObtaining Authentication Nonce

Generate JWT TokenLogin to Messaging Server

curl -X GET \ -H "x-diuit-application-id: ${DIUIT_APP_ID}" \ -H "x-diuit-api-key: ${DIUIT_APP_KEY}" \ https://api.diuit.net/1/auth/nonce

curl -X POST \ -H "x-diuit-application-id: ${DIUIT_APP_ID}" \ -H "x-diuit-api-key: ${DIUIT_APP_KEY}" \ -H "Content-Type: application/json" \ -d '{"authToken":${JWT_TOKEN}, "deviceId": ${DEVICE_ID}, "platform": ${PUSH_PLATFORM}https://api.diuit.net/1/auth/login

API DOCUMENThttp://api.diuit.com

SAMPLE CODEhttps://github.com/diuitAPI

EVENTHTTPS://WWW.FACEBOOK.COM/DIUIT

THANKS FOR YOUR ATTENTION

top related