OpenChannel
@objc(SBDOpenChannel)
open class OpenChannel : BaseChannel
The OpenChannel
class represents a open channel which is a public chat.
Any users who wants to enter the channel can join freely. This class is derived from BaseChannel
.
If the OpenChannelDelegate
is added, the user will automatically receive all messages from the
channels where the user belongs after connection. The OpenChannel
does not provide the features that
GroupChannel
does, but it can handle much more users.
For more information, see Group Channel.
-
The number of participants in this channel.
Declaration
Swift
@objc open internal(set) var participantCount: Int { get }
-
The operators of this channel.
Declaration
Swift
@objc open internal(set) var operators: [User]? { get }
-
Returns the user is an operator or not.
Declaration
Swift
@objc(isOperatorWithUser:) open func isOperator(user: User) -> Bool
Parameters
user
The user object.
Return Value
If
true
, the user is an operator. -
Returns the user ID is an operator or not.
Declaration
Swift
@objc open func isOperator(userId: String) -> Bool
Parameters
userId
The user ID.
Return Value
If
true
, the user ID is an operator. -
Default constructor.
Declaration
Swift
public required init(from decoder: Decoder) throws
Parameters
decoder
Decoder
instance -
Encodes this object.
Declaration
Swift
open override func encode(to encoder: Encoder) throws
Parameters
encoder
Encoder
instance -
Compares this object with given other object.
Declaration
Swift
public override func isEqual(_ object: Any?) -> Bool
Parameters
object
Any
instanceReturn Value
true
if same otherwisefalse
-
Creates an open channel.
Note
The name and cover URL of the channel are generated in Sendbird server.Declaration
Swift
@objc(createChannelWithCompletionHandler:) open class func createChannel(completionHandler: @escaping OpenChannelHandler)
Parameters
completionHandler
The handler block to execute.
-
Creates a open channel with
OpenChannelCreateParams
class.Since
3.0.206Declaration
Swift
@objc(createChannelWithParams:completionHandler:) open class func createChannel( params: OpenChannelCreateParams, completionHandler: @escaping OpenChannelHandler )
Parameters
params
Instance of
OpenChannelCreateParams
what has properties to create open channel.completionHandler
Handler block to execute.
channel
is the open channel instance. -
Creates a open channel with
OpenChannelCreateParams
class.Since
3.0.206Declaration
Swift
@objc(createChannelWithParams:progressHandler:completionHandler:) open class func createChannel( params: OpenChannelCreateParams, progressHandler: ProgressHandler?, completionHandler: @escaping OpenChannelHandler )
Parameters
params
The parameter instance of
OpenChannelCreateParams
what has properties to create open channel.progressHandler
The handler block to monitor progression.
bytesSent
is the number of bytes sent since the last time this method was called.totalBytesSent
is the total number of bytes sent so far.totalBytesExpectedToSend
is the expected length of the body data. These parameters are the same to the declaration ofurlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)
.completionHandler
The handler block to execute.
channel
is the open channel instance. -
Updates this channel with
OpenChannelUpdateParams
class.Since
3.0.206Declaration
Swift
@objc(updateChannelWithParams:completionHandler:) open func update( params: OpenChannelUpdateParams, completionHandler: @escaping OpenChannelHandler )
Parameters
params
The parameter instance of OpenChannelCreateParams what has properties to update open channel.
completionHandler
The handler block to execute.
channel
is the open channel instance. -
Updates this channel with
OpenChannelUpdateParams
class.Since
3.0.206Declaration
Swift
@objc(updateChannelWithParams:progressHandler:completionHandler:) open func update( params: OpenChannelUpdateParams, progressHandler: ProgressHandler?, completionHandler: @escaping OpenChannelHandler )
Parameters
params
The parameter instance of OpenChannelCreateParams what has properties to update open channel.
progressHandler
The handler block to monitor progression.
bytesSent
is the number of bytes sent since the last time this method was called.totalBytesSent
is the total number of bytes sent so far.totalBytesExpectedToSend
is the expected length of the body data. These parameters are the same to the declaration ofurlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)
.completionHandler
The handler block to execute.
channel
is the open channel instance. -
Deletes this channel
Since
3.0.180Declaration
Swift
@objc(deleteChannelWithCompletionHandler:) open func delete(completionHandler: SBErrorHandler?)
Parameters
completionHandler
The handler block to execute.
channel
is the open channel instance which is deleted. -
Gets an open channel instance from channel URL.
Declaration
Swift
@objc(getChannelWithURL:completionHandler:) open class func getChannel( url: String, completionHandler: OpenChannelHandler? )
Parameters
url
The channel URL.
completionHandler
The handler block to execute.
channel
is the open channel instance which has thechannelURL
. -
Refreshes the channel information.
Declaration
Swift
open func refresh(completionHandler: SBErrorHandler?)
Parameters
completionHandler
The handler block to execute.
-
Enters this channel.
Declaration
Swift
@objc(enterChannelWithCompletionHandler:) open func enter(completionHandler: SBErrorHandler?)
Parameters
completionHandler
The handler block to execute.
-
Exits this channel.
Declaration
Swift
@objc(exitChannelWithCompletionHandler:) open func exit(completionHandler: SBErrorHandler?)
Parameters
completionHandler
The handler block to execute.
-
Creates a query instance for open channel list.
Declaration
Swift
@objc open class func createOpenChannelListQuery() -> OpenChannelListQuery
Return Value
The query instance for open channel list.
-
Creates a query instance for open channel list.
Declaration
Swift
@objc open class func createOpenChannelListQuery(paramsBuilder: (OpenChannelListQueryParams) -> Void) -> OpenChannelListQuery
Parameters
paramsBuilder
The builder closure for setting
OpenChannelListQueryParams
.Return Value
The query instance for open channel list.
-
Creates a query instance for open channel list.
Declaration
Swift
@objc open class func createOpenChannelListQuery(params: OpenChannelListQueryParams) -> OpenChannelListQuery
Parameters
params
The params object to change query condition.
Return Value
The query instance for open channel list.
-
Creates a query instance for getting participant list of the channel with the given channel URL.
Declaration
Swift
@objc open class func createParticipantListQuery(channelURL: String) -> ParticipantListQuery
Parameters
channelURL
URL of the channel to create the query with.
Return Value
ParticipantListQuery instance for the participant list of the channel instance.
-
Creates a query instance for getting participant list of the channel with the given channel URL.
Declaration
Swift
@objc open class func createParticipantListQuery(channelURL: String, paramsBuilder: (ParticipantListQueryParams) -> Void) -> ParticipantListQuery
Parameters
channelURL
URL of the channel to create the query with.
paramsBuilder
The builder closure for setting
ParticipantListQueryParams
.Return Value
ParticipantListQuery instance for the participant list of the channel instance.
-
Creates a query instance for getting participant list of the channel with the given channel URL.
Declaration
Swift
@objc open class func createParticipantListQuery(channelURL: String, params: ParticipantListQueryParams) -> ParticipantListQuery
Parameters
channelURL
URL of the channel to create the query with.
params
The params object to change query condition.
Return Value
ParticipantListQuery instance for the participant list of the channel instance.
-
Creates a participant list query for this channel.
Declaration
Swift
@objc open func createParticipantListQuery() -> ParticipantListQuery?
Return Value
UserListQuery
instance for the participant list of the channel instance. -
Creates a participant list query for this channel.
Declaration
Swift
@objc open func createParticipantListQuery(paramsBuilder: (ParticipantListQueryParams) -> Void) -> ParticipantListQuery?
Parameters
paramsBuilder
The builder closure for setting
ParticipantListQueryParams
.Return Value
UserListQuery
instance for the participant list of the channel instance. -
Creates a participant list query for this channel.
Declaration
Swift
@objc open func createParticipantListQuery(params: ParticipantListQueryParams) -> ParticipantListQuery?
Parameters
params
The params object to change query condition.
Return Value
UserListQuery
instance for the participant list of the channel instance. -
Deserializes and reconstructs the object
Declaration
Swift
open override class func build(fromSerializedData data: Data?) -> `Self`?
Parameters
data
Data
instanceReturn Value
OpenChannel
if parameter is valid, otherwisenil