NIMChatroomIndependentMode Class Reference
Inherits from | NSObject |
---|---|
Declared in | NIMChatroomEnterRequest.h |
username
User name in independent mode
@property (nullable, nonatomic, copy) NSString *username
Discussion
User name in independent mode
If the value is set to nil, the SDK will log in with an anonymous account. In anonymous mode, NIMChatroomEnterRequest must contain the nickname and avatar
Declared In
NIMChatroomEnterRequest.h
anonName
If username is set to nil, use anonymous login. This variable determines the anonymous account. If nil is used, the account is automatically generated by the SDK
@property (nullable, nonatomic, copy) NSString *anonName
Discussion
If username is set to nil, use anonymous login. This variable determines the anonymous account. If nil is used, the account is automatically generated by the SDK
Declared In
NIMChatroomEnterRequest.h
token
Token used in independent mode
@property (nullable, nonatomic, copy) NSString *token
Discussion
Token used in independent mode
token is invalid if the user name is empty
Declared In
NIMChatroomEnterRequest.h
chatroomAppKey
Chat room AppKey, optional. If unspecified, use CommsEase IM AppKey
@property (nullable, nonatomic, copy) NSString *chatroomAppKey
Discussion
Chat room AppKey, optional. If unspecified, use CommsEase IM AppKey
Declared In
NIMChatroomEnterRequest.h
+ registerRequestChatroomAddressesHandler:
Register the callback for getting the URL of a chat room
+ (void)registerRequestChatroomAddressesHandler:(NIMRequestChatroomAddressesHandler)handler
Parameters
handler |
method to get the URL of a chat room |
---|
Discussion
Register the callback for getting the URL of a chat room
If a user joins a chat room and refreshing the chat room IP, the SDK will call this callback and pass in the roomId
and callback
parameters.
The callback requires the upper layer of the application to use roomId
to make a request to obtain the corresponding address of a chat room and return the address to the SDK using the callback.
Note that no matter whether the request is successful, the callback must return the result. Otherwise, the request to enter the chat room will wait continuously. This interface is only registered once, and later registrations will overwrite the previous registration.
Reference code:
[NIMChatroomIndependentMode registerRequestChatroomAddressesHandler:^(NSString * Nonnull roomId, NIMRequestChatroomAddressesCallback Nonnull callback) { [YourHTTPService request:roomId completion:^(NSError error,NSArray addresses) { //The callback must return the result, no matter the request is successful if(callback) { callback(error,addresses); } }]; }];
Declared In
NIMChatroomEnterRequest.h