Browse SDKs · React Native
SDKsReact Native

Before you start

Prepare OpenIMServer, user credentials, and a React Native project before initializing and signing in.

Copy

Before integrating the OpenIM SDK into a React Native application, prepare an accessible OpenIMServer, a trusted user authentication flow, and a React Native project that can compile the native module.

Prepare OpenIMServer

If you do not have an OpenIMServer instance, follow the Docker deployment guide to deploy one. Confirm that the target device can reach these addresses:

FieldDescription
apiAddrOpenIMServer HTTP API address for login, synchronization, and resource requests.
wsAddrOpenIMServer WebSocket address for the long-lived connection and realtime events.

Do not verify connectivity only from the development computer. Android emulators, iOS simulators, and physical devices can use different network paths. In production, also check DNS, TLS certificates, firewalls, reverse proxies, and WebSocket upgrades.

Prepare users and tokens

userID identifies an OpenIM user, and token authenticates that user. A trusted backend should create or bind users, issue tokens, and validate application permissions. A React Native application must not store administrator tokens, secrets, or other server credentials.

Before integrating the OpenIMServer REST API in your backend, read Prepare to use the Platform API and Issue a session token. After authenticating its own accounts, your backend should return only the following SDK login data to the client:

DataDescription
userIDOpenIM user ID for the account being signed in.
tokenLogin token issued for that user.
apiAddrOpenIMServer HTTP API address.
wsAddrOpenIMServer WebSocket address.

The userID must match the user encoded by the token.

Prepare the React Native project

Before integration, confirm that:

  • The project has completed native configuration for either React Native CLI or an Expo custom development client.
  • The Android and iOS projects can each build and run.
  • Android and iOS network configuration is available, and the target device can reach apiAddr and wsAddr.

The React Native SDK runs through native modules and is not available in Expo Go. An Expo project must use expo prebuild to generate or update the Android and iOS projects that include the SDK native module, then build a custom development client. See React Native environment integration for the installation steps.

Continue integration

After completing these preparations, first follow React Native environment integration to install dependencies and configure the native projects. Then follow Authenticate and manage a session to initialize the SDK and sign in, and finally try Send your first message.