preface

Develop a support for national IM chat, can have basic functions, send text, pictures, files and so on related content.


Tencent IM Products

An overview of the

Tencent Instant Messaging IM is an instant messaging program launched by Tencent. The current time is March 2020 (Tencent IM’s promotional activities and sales plan will change from time to time). The IM provides an all-end access interface, a stable and accessible instant messaging cloud service with global coverage.

Application scenarios

Including but not limited to the following scenarios:   

The characteristics of

Message transmission

Supports text, picture, short voice, short video and other rich media messages, as well as customized messages and customized expressions. Supports the preservation of historical roaming messages, integrates message recall, message forwarding, and security attack capabilities, and builds a stable and convenient message transmission channel.

Session management

Integrated TUIKit components, easy to add session, session top, session list display, unread message count, historical roaming message display and other functions.

Group management

Support group member management, group custom fields, group information and group announcement change and display, group top, provide private group, public group, chat room, audio and video chat room and other groups to meet the needs of personalized groups.

Data management

You can set user information, change profile picture, configure friend relationship, and provide friend authentication options, which are suitable for your business scenarios.

Flagship edition and professional edition function comparison

IM packages are classified into Experience edition, Professional edition, and flagship edition. After an application is created, the default IM package is Experience edition (free). You can select different IM packages based on your service requirements.

The architecture

IM provides global access, single chat, group chat, message push, data relationship chain hosting, account authentication and other comprehensive solutions, and provides a complete App access, background management interface.

cost

After September 14, 2018, all customers who register with sdkappID will need to purchase 999, which is not used before, which means that you want to make your own Demo and issue 999 first, as shown below:


Use Tencent IM to prepare

Product synopsis: cloud.tencent.com/document/pr… Price: cloud.tencent.com/document/pr… Application scenarios: cloud.tencent.com/document/pr… The Demo experience: cloud.tencent.com/document/pr… Access SDK:cloud.tencent.com/document/pr…

Tencent IM service SDKAppID and secret key

  

Tencent Development Documents

Cloud.tencent.com/document/pr… Download the SDK

Basic concepts of IM SDK

The session

There are two types of conversations:

  • One is A C2C session, which is a conversation established between the user and the peer in a single chat. Messages are read and sent through the session.
  • One is a group session, which is a session composed of members in a group. All members in the group can receive the message sent in the group session. As shown in the figure below, a session represents a conversation with a friend.

  

The message

In IM SDK, Message refers to the content to be sent to the other party. The Message includes several attributes, such as whether it has been read, whether it has been successfully sent, the sender account, and the time when the Message is generated. A message consists of multiple ELEMs. Each Elem can be a text, picture, or expression. Multiple ELEMs can be used to send a message.

The group ID

Group ID Uniquely identifies a group. It is generated by the background and returned when a group is created.

IM SDK usage instructions

     

IM SDK interface

Address: document cloud.tencent.com/document/pr… If the parameter string of the interface contains Chinese characters, use UTF-8 encoding.

Event callback interface

  

The IM SDK initializes related interfaces

  

Login and logout related interfaces

  

Session-specific interface

  

Message dependent interface

  

Group related Interfaces

  

User profile related interface

  

Relationship chain related interfaces

  


modular

  

Key code of Demo

tencentIMManager.pri

# ImSDK
INCLUDEPATH += $$PWD/ImSDK/includes
HEADERS += \
    $$PWD/ImSDK/includes/TIMCloud.h \
    $$PWD/ImSDK/includes/TIMCloudCallback.h \
    $$PWD/ImSDK/includes/TIMCloudComm.h \
    $$PWD/ImSDK/includes/TIMCloudDef.h

LIBS += -L$$PWD/ImSDK/lib/Win32/Release \
        -limsdk
Copy the code


Project template V1.0.0

V1.0.0 for the module


Into the pit

Pit 1: Login authentication problem

The problem

Logon, callback error 70003

why

Each time you log in to the system, you need to enter the userId and UserSig. The UserSig is generated based on the userId. The two authentications are considered to be unique and reliable.

The solution

Local generation of userSig, do large chat to prevent cracking to improve security, can let the background to Tencent generation of userSig, to ensure reliability. I’m going to put two files in the code.

Pit 2: missing library “bcrypt” during compilation authentication

The problem

  

To solve

  Qt environment built-in, library files added to it

The library “zlib” is missing during compilation authentication.

The problem

  

why

Lack of zlib library, need to compile yourself

To solve

Please refer to the blog: zlib development Notes (a) : Zlib library introduction, compilation and engineering template “add header file path and library

Pit four: Error 70003 is reported when landing

The problem

  

why

Chinese userId.

To solve

Only English numeric IDS can be used.

Pit five: Error 70003 when landing

The problem

  

why

  

To solve

Using STD: : string


If the paper is original articles, reprint please indicate the original source This article blog: hpzwl.blog.csdn.net/article/det…