Package io.ably.lib.objects
Interface ObjectsPlugin
public interface ObjectsPlugin
The ObjectsPlugin interface provides a mechanism for managing and interacting with
live data objects in a real-time environment. It allows for the retrieval, disposal, and
management of Objects instances associated with specific channel names.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of the plugin instance and all underlying resources.void
Disposes of the RealtimeObjects instance associated with the specified channel name.@NotNull RealtimeObjects
getInstance
(@NotNull String channelName) Retrieves an instance of RealtimeObjects associated with the specified channel name.void
handle
(@NotNull ProtocolMessage message) Handles a protocol message.void
handleStateChange
(@NotNull String channelName, @NotNull ChannelState state, boolean hasObjects) Handles state changes for a specific channel.
-
Method Details
-
getInstance
Retrieves an instance of RealtimeObjects associated with the specified channel name. This method ensures that a RealtimeObjects instance is available for the given channel, creating one if it does not already exist.- Parameters:
-
channelName
- the name of the channel for which the RealtimeObjects instance is to be retrieved. - Returns:
- the RealtimeObjects instance associated with the specified channel name.
-
handle
Handles a protocol message. This method is invoked whenever a protocol message is received, allowing the implementation to process the message and take appropriate actions.- Parameters:
-
message
- the protocol message to handle.
-
handleStateChange
void handleStateChange(@NotNull @NotNull String channelName, @NotNull @NotNull ChannelState state, boolean hasObjects) Handles state changes for a specific channel. This method is invoked whenever a channel's state changes, allowing the implementation to update the RealtimeObjects instances accordingly based on the new state and presence of objects.- Parameters:
-
channelName
- the name of the channel whose state has changed. -
state
- the new state of the channel. -
hasObjects
- flag indicates whether the channel has any associated objects.
-
dispose
Disposes of the RealtimeObjects instance associated with the specified channel name. This method removes the RealtimeObjects instance for the given channel, releasing any resources associated with it. This is invoked when ablyRealtimeClient.channels.release(channelName) is called- Parameters:
-
channelName
- the name of the channel whose RealtimeObjects instance is to be removed.
-
dispose
void dispose()Disposes of the plugin instance and all underlying resources. This is invoked when ablyRealtimeClient.close() is called
-