Yun2win Instant Messaging Cloud service Fast access method

Source: Internet
Author: User
Tags docker run

Brief introduction

Yun2win provides a one-stop communication cloud service to developers. Developers can easily and quickly integrate their communication capabilities into their applications by downloading the client's SDK and cloud APIs without having to invest in development costs.

Through in-depth market research and experience feedback, we found that information security is the most important standard and the biggest concern for users when they choose to access an open communication cloud service. Yun2win uses hybrid cloud architecture, data physical isolation method, data through our open source cloud backend, directly to your self-deployed storage location, completely without the Yun2win server, no security concerns.

Architecture Introduction

The main features of the Yun2win architecture design are:

    • The data server is open source, controlled by the developer deployment, and Yun2win will not receive any message data.
    • App Business Server, data server can be deployed to the intranet, as long as the client can access the Yun2win server, can still communicate instantly.

As the figure shows, Yun2win never receives or owns any message data from the developer app. This characteristic is very suitable for the application situation which is sensitive to the message data security, such as intra-enterprise communication.

Get Appkey

To use Yun2win, you need to obtain one AppKey and, as follows AppSecret , the following steps:

    1. Open the registration page and enter your email address to register
    2. After successful registration, open the login page and enter the console
    3. The system has created an app for you, click Open, and in the Appkey menu you can get AppKey andAppSecret

Remind

Make a note of AppKey and AppSecret , after the server configuration needs to be used.

Server-side Deployment

This section is primarily responsible for the storage of instant messaging business data, including: messages, conversations, user relationships, and so on. This section has the following features:

    • Fully Open source
    • External interface is restful API
    • Self-deployment by developers, data security assured

Download

Server-side code in github.com open source, please download from the following URL:

Https://github.com/yun2win/yun2win-sdk-server

Remind

Code please download stable version of releases

Environment installation

To run this service hardware requirements (recommended):

    • CPU: Dual Core
    • Memory: 8G
    • Storage: 200G
    • Bandwidth: 5M

To run this service software requirement:

    • Operating system: CentOS 5.8+ (recommended)
    • Operating Environment: Nodejs 0.8+
    • Process Management: PM2
    • Database: MySQL

1, install Nodejs

To perform command operations at the command line, first install the dependent libraries and tools:

Copy
yum -y install gcc make gcc-c++ openssl-devel wget                        

This command runs the corresponding package that requires network download. If the server is unable to connect, use the Docker deployment scenario

Download Nodejs:

Copy
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz                        

To unzip it:

Copy
tar -zvxf node-v0.10.26.tar.gz                            

Compile and install:

Copy
cd node-v0.10.26make && make install                        

The final verification is successful:

Copy
node -v                        

If the version information appears, the installation is successful

2, install PM2

Nodejs after successful installation, use directly:

Copy
npm install pm2 -g                        

Wait a few seconds, if you have permission problems, use:

Copy
sudo npm install pm2 -g                        
3, install MySQL

At the command line, enter the following instructions to install:

Copy
yum install -y mysql-server mysql mysql-devel                        

CentOS 7 's Yum source does not appear to be properly installed when MySQL mysql-sever file, need to go to the official web download

Copy
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpmrpm -ivh mysql-community-release-el7-5.noarch.rpmyum -y install mysql-community-server                        

This command runs the corresponding package that requires network download. If the server is unable to connect, use the Docker deployment scenario

When the installation is complete, start MySQL:

Copy
service mysqld start                        

MySQL database will only have a root administrator account after installation, but at this time the root account has not set a password for it, execute the following command to set the password:

Copy
mysqladmin -u root password ‘【新密码】‘                        

Then create a new database yun2win_db, note that the character set needs to be set to utf-8 . The following first login MySQL:

Copy
mysql -u root -p                        

Enter the password, and then execute

Copy
CREATE DATABASE yun2win_db DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;                        
Remind

Make a note of 新密码 and, 数据库帐号 and 数据库名称yun2win_db , after the server configuration needs to be used.

Deployment Configuration

To configure before running, open the fileapp/config.js

Copy
Module.Exports={ Database configurationDb:{Host:"LocalHost", Default local, if non-local data please changeDatabase:' {database name} ', If not changed it is yun2win_dbUsername:"SA", Database accountPassword:"{Database Password}",Dialect:"MySQL" }, Client configuration for client connection to this server and to the notification serverClient:{AppKey:"{AppKey}", Appserect: "{Appserect}" , Tokenperiod:24*< Span class= "lit" >30 //token limited time, per hour  },< Span class= "PLN" > //session configuration  Session:{:1 //time for active user sessions, per hour Span class= "PLN" > }, //set to True, the basic test case is run at startup. If the test case passes, the deployment succeeds.  Testing:false };    

Note that you need to create a new database after installing MySQL. After the configuration is complete, copy all the code to the server's /root/yun2win folder. If you do not have permission to access it, you can copy any folder. The command line then executes the required modules for installation:

Copy
cd /root/yun2win //如果你更改过目录,这里也要更改npm install 

Then you can start

Copy
pm2 start server.js                        

After a successful start, you can use the instructions to pm2 list view the run condition.

To enable the program to self-start, it also executes:

Copy
pm2 savepm2 startup                        

The deployment is complete, using the ifconfig view 服务器IP , the server URL ishttp://{服务器IP}:18080

Remind

Make a note of the server URL and provide it to the client:/HTTP {服务器IP} : 18080

If you need to change the Server service port, openserver.js

Copy
/*** Module dependencies.*/VarApp=Require('./app ');VarDebug=Require(' Debug ')(' Web:server ');Var http = Require ( ' http ') Span class= "pun"); /*** Get port from environment and store in Express.*///is changed here to the port you want, such as 80var port = Normalizeport (process. Env. PORT | |   ' 18080 ' ); . ' Port ' , Port  

To change the port to 80:

Copy
/*** Module dependencies.*/VarApp= Require (var debug = Require ( span class= "str" > ' debug ' ) ( ' web:server ' var http = Require ( span class= "str" > ' http ' ); /*** Get port from environment and store in Express.*/appset ( ' Port ' ,  "            
Remind

If the port is changed, the address provided to the client also needs to be changed:/http {服务器IP} :{新端口}

Docker deployment

Docker is an open-source application container engine that allows developers to package their applications and dependencies into a portable container, and then publish them to any popular Linux machine or virtualize them. Containers are completely sandbox-aware and do not have any interfaces with each other. There is little performance overhead and can be easily run in machines and data centers. Most importantly, they are not dependent on any language, framework including system.

To make it easier for developers to deploy, we've also provided Docker images that can be easily deployed to the environment you want.

  1. Installing Docker

    For detailed installation Help, refer to: http://udn.yyuap.com/doc/chinese_docker/

  2. Download image file

    Click on the following URL to download: yun2win_v0.3.tar.gz (223.1 MB)

    Download complete, unzip

  3. Import Mirror

    Copy
        $ sudo docker load --input yun2win.v0.3.tar
  4. New container Start

    Copy
        $ sudo docker run -t -i -p 80:80 yun2win/centos:v0.3 /bin/bash 

    This container starts with a port mapping, if the current server 80 is occupied and needs to be changed, such as 18080, then adjust -p 80:80 to -p 18080:80

  5. At this point the address of the server is:http://{服务器IP}

Web-side Integration download

Server-side code in github.com open source, please download from the following URL:

https://github.com/yun2win/yun2win-sdk-web/

Environment installation

To run this service hardware requirements (recommended):

    • CPU: Dual Core
    • Memory: 2G
    • Bandwidth: 5M

To run this service software requirement:

    • Operating systems: Windows, Mac, Linux

Deployment Configuration

To configure before running, open the filejs/core/config.js

Copy
config.baseUrl = http://{服务器IP}
iOS-side integration

This section is the IM iOS client SDK, including: Mqtt module. This section has the following features:

    • Frame Light
    • Suitable for weak nets
    • Can be connected to obverse

Download

Server-side code in github.com open source, please download from the following URL:

Https://github.com/yun2win/yun2win-sdk-server

Remind

Code please download stable version of releases

Environment installation

Compilation Environment:

    • Xcode-version 7.2.1 (7c1002) and above

Equipment Environment:

      Device Model
    • IPhone5 and above
      Equipment System
    • iOS8.0 and above

Deployment Configuration

After the download, there are two folders, Example (sample code) and Y2W_IM_SDK

    1. Please open the project using Api.xcworkspace in the example folder
    2. /API/Model/Y2WServiceConfig.mserver address configuration using the methods in the file + (NSString *)domain , just change the address and port to switch servers

                                        + (NSString *)domain { return @"{服务器IP}"; // 例如: @"http://192.169.0.1:8080/" }
Android-Side Integrated download

Client code in github.com open source, please download from the following URL:

Https://github.com/yun2win/yun2win-sdk-android

Remind

Code please download stable version of releases

Environment installation

Equipment Environment:

    • Android phone
    • System 4.2 or more

Compilation Environment:

    • Operating Environment: Android Studio

Download Android Studio:

Copy
wget http://www.android-studio.org/                        
Deployment Configuration
    • GitHub download source Extract to Local

    • Install Android Studio

    • Open Android Studio Select Import Source

    • If the data service background is configured, modify the server address

    • Get Appkey and modify

Yun2win Instant Messaging Cloud service Fast access method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.