ARTChannelProtocol
Objective-C
@protocol ARTChannelProtocol
Swift
protocol ARTChannelProtocol
The protocol upon which the ARTChannel
is implemented.
-
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
name
The name of the message.
data
The 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
name
The name of the message.
data
The payload of the message.
callback
A 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
messages
An array of
ARTMessage
objects.callback
A success or failure callback function.