ARTChannelProtocol
Objective-C
@protocol ARTChannelProtocol
Swift
protocol ARTChannelProtocol
The protocol upon which ARTRestChannelProtocol and ARTRealtimeChannelProtocol are based.
-
The channel name.
Declaration
Objective-C
@property (readonly) NSString *_Nonnull name;Swift
var name: String { get } -
Publishes a single message to the channel with the given event name and payload. When publish is called with this client library, it won’t attempt to implicitly attach to the channel, so long as transient publishing is available in the library. Otherwise, the client will implicitly attach.
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data;Swift
func publish(_ name: String?, data: Any?)Parameters
nameThe name of the message.
dataThe payload of the message.
-
Publishes a single message to the channel with the given event name and payload. A callback may optionally be passed in to this call to be notified of success or failure of the operation. When publish is called with this client library, it won’t attempt to implicitly attach to the channel, so long as transient publishing is available in the library. Otherwise, the client will implicitly attach.
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data callback:(nullable ARTCallback)callback;Swift
func publish(_ name: String?, data: Any?, callback: ARTCallback? = nil)Parameters
nameThe name of the message.
dataThe payload of the message.
callbackA success or failure callback function.
-
Publishes an array of messages to the channel. A callback may optionally be passed in to this call to be notified of success or failure of the operation.
Declaration
Objective-C
- (void)publish:(nonnull NSArray<ARTMessage *> *)messages callback:(nullable ARTCallback)callback;Swift
func publish(_ messages: [ARTMessage], callback: ARTCallback? = nil)Parameters
messagesAn array of
ARTMessageobjects.callbackA success or failure callback function.