Ape Table EP2 once staged a large-scale PK on the topic of "cross-platform or native?". The three guests were all brothers on the side. After some debate, they basically favored the use of cross-platform solutions. Follow [Rongyun Global Internet Communication Cloud] to learn more

It is true that the cross-platform development solution has obvious advantages. Applying one set of code to multiple platforms not only saves costs, but also improves speed and efficiency, provides users with a consistent experience on different platforms, and facilitates later maintenance iterations.

In order to allow developers to integrate IM modules more conveniently and quickly, Rongyun supports full-technology stack development with full-platform capabilities to meet the needs of different business types and business scenarios. With the explosion of mobile applications and "every application must be socialized", the use of React Native (RN) framework to integrate IM instant messaging capabilities is favored by enterprises and developers.

Recently, Rongyun has carried out a new revision and upgrade to the RN IM SDK, the interface design is more concise, and the super group and other capabilities have been added to meet the needs of more developers for fast and efficient integration.


Simpler interface design

RN is a cross-platform mobile application development framework that was open sourced by Facebook (now Meta) in April 2015, and supports two platforms: iOS and Android.

RN supports building native apps on the basis of JaveScript and React, which means that every view is indistinguishable from the native one, and a set of code is perfectly adapted to iOS and Android devices.

For mobile business, especially new applications without historical baggage, the React Native framework is an excellent choice for business development.
图片
Rongyun's recently revised and upgraded RN IM SDK has richer interface design functions, clearer interface, simpler integration, and more convenient use.

For example, when we want to use the RN IM SDK to implement the function of sending a text message, the old and new version code examples are as shown below.

old version:

new version:

Comparing the code, we can draw the following conclusions:

Legacy:

  1. The developer needs to construct the message body object by himself;
  2. When calling the send message interface, the developer needs to pass in the callback function by himself.

New version:

  1. The SDK provides an interface for creating message body objects, which developers only need to call;
  2. When calling the API interface for sending messages, the developer does not need to pass in the callback function, and can set the listener separately when the callback is required.

By comparison, we can intuitively feel the difference between the two. Compared with the cumbersome process and complex interface definition of the old SDK, the new SDK is easy to use, less error-prone, and the interface definition is clearer.

Integration Guidelines 👉 Rongyun Cross-Platform IM - React Native

In addition, the new RN IM SDK also adds supergroup and log functions.


Supergroup in RN IM SDK

Supergroup is the first blockbuster capability that Rongyun launched in the industry this year. It helps customers build a "Discord-like" real-time community, and conducts long-term operation and management of large-scale users and diverse content. It is a game community, interest community, study group, Fan operation and other products are a powerful tool for realizing unlimited real-time user interaction capabilities.

Once launched, Rongyun Super Group has become a surprise choice for developers in the vertical social field. There are many typical products at home and abroad based on the ability of Rongyun Super Group to launch business.

Rongyun RN IM SDK also provides super group function and provides rich interfaces for developers to call.
图片
For example, to send a supergroup message and receive a supergroup message, execute the following sample code:

As can be seen from the above code block, sending a supergroup message only takes two steps:

  1. Call the API interface for creating a message provided by the SDK, and specify the type of the message as the super group type;
  2. Call the message sending API interface provided by the SDK, and pass the created message body into the interface.

Receiving super group messages is equally simple, just use the unified reception message monitoring provided by the SDK.

The reason why sending messages, receiving messages and other interfaces inside the SDK is so simple and fast is that Rongyun has specially processed the underlying implementation of the SDK, which we call the tiling layer.


Tiled layer design for cross-platform capability

The tiling layer is one of the solutions implemented by the cross-platform IM SDK. Its main function is to solve the differences between the iOS platform and the Android platform, handle the complicated and complex IM instant messaging functions, and provide clear and convenient APIs to the IM SDK of each platform. interface.

The structure of the cross-platform SDK is as follows:
图片
As can be seen from the above figure, the bottom layer is the Rongyun native IMLib layer , which is the specific implementation of the instant messaging function, and the next layer is the tiling layer . The main functions of the tiling layer are:

  • Implementation of specific functions
  • Handling complex business logic
  • Integrate the API interface provided by the native IMLib layer to ensure a high degree of uniformity
  • Dealing with differences in different platforms
  • Easy for developers to access

Then, the tiling layer will provide a clear API interface to the cross-platform layer, and the cross-platform layer will encapsulate the API interface of the tiling layer and finally provide it to developers.

At a time when social products are diverse and gameplay is innovative, efficiency is the last word.

Rongyun IM is not only a "capable person" in the field of instant messaging, but also has full-line instant messaging functions such as single group chat, system notification, super group, chat room, etc. It also has the advantages of stronger productized performance and more comprehensive platform coverage. It greatly facilitates developers' business implementation and helps them quickly integrate IM capabilities in various scenarios.


融云RongCloud
82 声望1.2k 粉丝

因为专注,所以专业