It only takes 4 steps to build an online chat room from 0!

Time:2021-12-25

It only takes 4 steps to build an online chat room from 0!

Different from single chat and group chat, chat room is a kind of integrationIntegration of multiple im functionsLarge scale real-time message distribution system. In 2000, as a new instant messaging scene, chat rooms quickly became popular among young people,“Netease chat room” “blue sea and silver sand”Led the boom of voice chat at that time.

Today, the momentum of chat rooms is no less than that of the past, and they are widely used inOnline KTV, Lianmai Kaihei, anchor PK, online showAnd other scenes, as well as interactive ways such as text, expression, praise and flowers, which set up a communication bridge, and the playing methods are more changeable.

This Yunxin small class teaches you how toQuickly integrate the chat room, and realize in and out of the chat room, simple messaging and permission managementAnd other functions.

Video Explanation

https://www.bilibili.com/vide…

Integrated chat room – Basics

Step1 initialize and enter the chat room

There are two ways to enter the chat room: entering the chat room in independent mode and entering the chat room in non independent mode.

  • Independent mode refers to the way to enter the chat room when Im is not logged in. It is for business scenarios that only need the chat room function. Please introduce NIM_ Web_ Chatroom_*. JS and through chatroom getInstance({…}) To initialize the chat room instance.
  • Non independent mode refers to the mode of completing im login first and then entering the chat room. For business scenarios that require IM and chat room functions. Please introduce NIM_ Web_ SDK_*. JS, and please use SDK NIM. getInstance({…}) And SDK Chatroom. getInstance({…}) To initialize IM and chat room instances respectively

Here, to facilitate the demonstration, select the independent mode:

It only takes 4 steps to build an online chat room from 0!

Step 2 send and receive messages

You cannot send / receive messages until you have successfully entered the chat room

It only takes 4 steps to build an online chat room from 0!

Step3 permission management

Chat room member management and chat room information query

It only takes 4 steps to build an online chat room from 0!

Step 4 leave the chat room

Leave or switch chat rooms

It only takes 4 steps to build an online chat room from 0!

Integrated chat room demo

Step1 download demo

Demo link:https://github.com/netease-ki…, download it locally, unzip it and open it through the IDE. During the download, take the lead in obtaining the app_ KEY;

It only takes 4 steps to build an online chat room from 0!

How to get app_ KEY?

If you are already a Netease Yunxin developer, you can directly obtain the app from the control background of Netease Yunxin_ KEY;

If this is the first experience, you need to go to the official website of Netease Yunxin(http://163.lu/f04GM3)Register Yunxin account – create application – click app_ Key management can obtain relevant information.

It only takes 4 steps to build an online chat room from 0!

Step 2 run demo

At NIM_ Web_ Demo-master\webdemo\imNew\js\config. JS, and then execute the NPM install and node app commands in the demo root directory

It only takes 4 steps to build an online chat room from 0!It only takes 4 steps to build an online chat room from 0!

Step3 experience demo function

openhttp://127.0.0.1:8182/webdemo…Address experience demo function; (it is recommended to log in to the account first)

It only takes 4 steps to build an online chat room from 0!It only takes 4 steps to build an online chat room from 0!

The code to realize the functions of sending and receiving messages, forbidden words, hacking and so on in the demo is in NIM_ Web_ Demo-master\webdemo\imNew\chatroom\src\js\link. JS and room JS, you can refer to the API documentation to supplement more functions

It only takes 4 steps to build an online chat room from 0!

summary

The above is the detailed explanation of the demo web access process of Netease Yunxin chat room solution. The chat room can be easily built according to the above steps.

The construction of any system is not achieved overnight, especially for entertainment and social products, self-developed chat rooms mean a high costLabor cost, time cost and capital cost。 The integrated communication cloud service expert Netease Yunxin provideschat roomSolution, which can realize fast online,1 dayYou can complete the integration work and easily deal with the high concurrency scenario of 100 million daily activities. Netease Yunxin will also continue to polish the underlying technical capabilities and provide more services for developersSimple integration and fast accessAudio, video and instant messaging solutions.