TWSStream Class Reference

Inherits from NSObject
Declared in TWSStream.h

Overview

Interface for Sync Pub-sub messaging primitive.

Message Stream is a Sync primitive for real-time pub-sub messaging. Stream Messages are not persisted, they exist only in transit, and will be dropped if (due to congestion or network anomalies) they cannot be delivered promptly.

  sid

An immutable system-assigned identifier of this Message Stream.

@property (readonly, nonnull) NSString *sid

Discussion

An immutable system-assigned identifier of this Message Stream.

Declared In

TWSStream.h

  uniqueName

An optional unique name for this stream, assigned at creation time.

@property (readonly, nullable) NSString *uniqueName

Discussion

An optional unique name for this stream, assigned at creation time.

Declared In

TWSStream.h

– publishMessageWithData:completion:

Publish a new message to this message stream.

- (void)publishMessageWithData:(nonnull TWSData *)data completion:(nullable TWSStreamMessageCompletion)completion

Parameters

data

Contains the payload of the dispatched message. Maximum size in serialized JSON: 4KB.

completion

Completion block that will specify the result of the operation and the unique message identifier if the operation is successful.

Discussion

Publish a new message to this message stream.

Declared In

TWSStream.h

– setTtl:completion:

Set time to live for stream object in seconds.

- (void)setTtl:(TWSDuration)ttl completion:(nullable TWSCompletion)completion

Parameters

ttl

Time to live in seconds from now or TWSDurationInfinity to indicate no expiry.

completion

Completion block that will specify the result of the operation.

Discussion

Set time to live for stream object in seconds.

This TTL specifies the minimum time the Stream will live, sometime soon after this time the object will be deleted.

If time to live is not specified, object lives infinitely long.

TTL could be used in order to auto-recycle old unused objects, but it is not recommended to build some app logic like timers using ttl.

Declared In

TWSStream.h

– removeStreamWithCompletion:

Remove the stream from the system, deleting it.

- (void)removeStreamWithCompletion:(nullable TWSCompletion)completion

Parameters

completion

Completion block that will specify the result of the operation.

Discussion

Remove the stream from the system, deleting it.

Declared In

TWSStream.h