onUserStatusChanged
Feature Introduction
info
This callback is triggered when the online status of subscribed users changes.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- Unity
Return Prototype
Function(UserStatusInfo info)? onUserStatusChanged;
Return Result
Name | Type | Description |
---|---|---|
info | UserStatusInfo | User status information |
Return Prototype
- (void)onUserStatusChanged:(OIMUserStatusInfo *)info;
Return Result
Name | Type | Description |
---|---|---|
info | OIMUserStatusInfo | User status information |
Return Prototype
void onUserStatusChanged(UsersOnlineStatus onlineStatus)
Return Result
Name | Type | Description |
---|---|---|
info | onlineStatus | User information |
Return Prototype
enum OnlineState {
Online = 1,
Offline = 0,
}
type UserOnlineState = {
platformID: Platform;
status: OnlineState;
userID: string;
};
onUserStatusChanged(data: WSEvent<UserOnlineState>): void;
Example Call
import { getSDK, CbEvents } from '@openim/wasm-client-sdk';
// or
// import { OpenIMSDK, CbEvents } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();
const IMSDK = getSDK();
IMSDK.on(
CbEvents.OnUserStatusChanged,
({ data }: WSEvent<UserOnlineState>) => {}
);
Return Result
Name | Type | Description |
---|---|---|
data | WSEvent | - |
Return Prototype
enum OnlineState {
Online = 1,
Offline = 0,
}
type UserOnlineState = {
platformID: Platform;
status: OnlineState;
userID: string;
};
onUserStatusChanged(data: WSEvent<UserOnlineState>): void;
Return Result
Name | Type | Description |
---|---|---|
data | WSEvent | - |
Example Call
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.subscribe(
IMSDK.IMEvents.OnUserStatusChanged,
({ data }: WSEvent<UserOnlineState>) => {}
);
Prototype
void OnUserStatusChanged(OnlineStatus userOnlineStatus);
Parameter
Parameter Name | Type | Description |
---|---|---|
userOnlineStatus | OnlineStatus | User Online Status |