11package io.ably.lib.objects
22
3- import io.ably.lib.objects.type.BaseLiveObject
4- import io.ably.lib.objects.type.map.LiveMapValue
53import io.ably.lib.realtime.ChannelState
64import io.ably.lib.realtime.CompletionListener
75import io.ably.lib.types.ChannelMode
@@ -49,6 +47,12 @@ internal fun LiveObjectsAdapter.throwIfInvalidAccessApiConfiguration(channelName
4947 throwIfInChannelState(channelName, arrayOf(ChannelState .detached, ChannelState .failed))
5048}
5149
50+ internal fun LiveObjectsAdapter.throwIfInvalidWriteApiConfiguration (channelName : String ) {
51+ throwIfEchoMessagesDisabled()
52+ throwIfMissingChannelMode(channelName, ChannelMode .object_publish)
53+ throwIfInChannelState(channelName, arrayOf(ChannelState .detached, ChannelState .failed, ChannelState .suspended))
54+ }
55+
5256// Spec: RTO2
5357internal fun LiveObjectsAdapter.throwIfMissingChannelMode (channelName : String , channelMode : ChannelMode ) {
5458 val channelModes = getChannelModes(channelName)
@@ -65,6 +69,12 @@ internal fun LiveObjectsAdapter.throwIfInChannelState(channelName: String, chann
6569 }
6670}
6771
72+ internal fun LiveObjectsAdapter.throwIfEchoMessagesDisabled () {
73+ if (! clientOptions.echoMessages) {
74+ throw clientError(" \" echoMessages\" client option must be enabled for this operation" )
75+ }
76+ }
77+
6878internal class Binary (val data : ByteArray ) {
6979 override fun equals (other : Any? ): Boolean {
7080 if (this == = other) return true
0 commit comments