diff --git a/content/chat/connect.textile b/content/chat/connect.textile index fe898b0f62..5bad284fdf 100644 --- a/content/chat/connect.textile +++ b/content/chat/connect.textile @@ -23,7 +23,7 @@ A connection can have any of the following statuses: | failed | This status is entered if the SDK encounters a failure condition that it cannot recover from. This may be a fatal connection error received from the Ably service, such as an attempt to connect with an incorrect API key, or some local terminal error, such as that the token in use has expired and the SDK does not have any way to renew it. | blang[javascript,swift]. - Use the "@current@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.ConnectionStatus.html#current"@status@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.ConnectionStatus.html#status property to check which status a connection is currently in: + Use the "@current@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.ConnectionStatus.html#current"@status@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/connectionstatus property to check which status a connection is currently in: blang[react]. Use the "@currentStatus@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseChatConnectionResponse.html#currentStatus property returned in the response of the "@useChatConnection@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useChatConnection.html hook to check which status a connection is currently in: @@ -69,7 +69,7 @@ blang[react]. blang[javascript,swift]. blang[javascript,swift]. - Use the "@connection.status.onChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.ConnectionStatus.html#onChange"@connection.onStatusChange()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Connection.html#onStatusChange method to register a listener for status change updates: + Use the "@connection.status.onChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.ConnectionStatus.html#onChange"@connection.onStatusChange()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/connection/onstatuschange%28%29-76t7 method to register a listener for status change updates: blang[react]. Listeners can also be registered to monitor the changes in connection status. Any hooks that take an optional listener to monitor their events, such as typing indicator events in the @useTyping@ hook, can also register a status change listener. Changing the value provided for a listener will cause the previously registered listener instance to stop receiving events. All messages will be received by exactly one listener. @@ -186,8 +186,8 @@ blang[react]. blang[javascript,swift]. The following discontinuity handlers are available: - * "Messages":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#onDiscontinuity"Messages":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Messages.html#onDiscontinuity - * "Presence":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#onDiscontinuity"Presence":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Presence.html#onDiscontinuity - * "Occupancy":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Occupancy.html#onDiscontinuity"Occupancy":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Occupancy.html#onDiscontinuity - * "Typing indicators":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#onDiscontinuity"Typing indicators":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Typing.html#onDiscontinuity - * "Room reactions":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomReactions.html#onDiscontinuity"Room reactions":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.RoomReactions.html#onDiscontinuity + * "Messages":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#onDiscontinuity"Messages":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/messages + * "Presence":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#onDiscontinuity"Presence":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/presence + * "Occupancy":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Occupancy.html#onDiscontinuity"Occupancy":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/occupancy + * "Typing indicators":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#onDiscontinuity"Typing indicators":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/typing + * "Room reactions":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomReactions.html#onDiscontinuity"Room reactions":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/roomreactions diff --git a/content/chat/rooms/history.textile b/content/chat/rooms/history.textile index 0ddadb503a..0806df10c5 100644 --- a/content/chat/rooms/history.textile +++ b/content/chat/rooms/history.textile @@ -13,7 +13,7 @@ The history feature enables users to retrieve messages that have been previously h2(#get). Retrieve previously sent messages blang[javascript,swift]. - Use the "@messages.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#get"@messages.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Messages.html#get method to retrieve messages that have been previously sent to a room: + Use the "@messages.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#get"@messages.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/messages/get%28options%3A%29 method to retrieve messages that have been previously sent to a room: blang[react]. Use the "@get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseMessagesResponse.html#get method available from the response of the @useMessages@ hook to retrieve messages that have been previously sent to a room. @@ -82,7 +82,7 @@ h2(#subscribe). Retrieve messages sent prior to subscribing Users can also retrieve historical messages that were sent to a room before the point that they registered a listener by "subscribing":/chat/rooms/messages#subscribe. The order of messages returned is from most recent, to oldest. This is useful for providing conversational context when a user first joins a room, or when they subsequently rejoin it later on. It also ensures that the message history they see is continuous, without any overlap of messages being returned between their subscription and their history call. blang[javascript,swift]. - Use the "@getPreviousMessages()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.MessageSubscriptionResponse.html#getPreviousMessages"@getPreviousMessages()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.MessageSubscription.html#getPreviousMessages function returned as part of a "message subscription":/chat/rooms/messages#subscribe response to only retrieve messages that were received before the listener was subscribed to the room: + Use the "@getPreviousMessages()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.MessageSubscriptionResponse.html#getPreviousMessages"@getPreviousMessages()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/messagesubscription/getpreviousmessages%28params%3A%29 function returned as part of a "message subscription":/chat/rooms/messages#subscribe response to only retrieve messages that were received before the listener was subscribed to the room: blang[react]. Use the "@getPrevious()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseMessagesResponse.html#getPreviousMessages method available from the response of the @useMessages@ hook to only retrieve messages that were received before the listener subscribed to the room. As long as a defined value is provided for the listener, and there are no message discontinuities, @getPreviousMessages()@ will return messages from the same point across component renders. If the listener becomes undefined, the subscription to messages will be removed. If you subsequently redefine the listener then @getPreviousMessages()@ will return messages from the new point of subscription. diff --git a/content/chat/rooms/index.textile b/content/chat/rooms/index.textile index 42c6c46ea5..4b975bec6d 100644 --- a/content/chat/rooms/index.textile +++ b/content/chat/rooms/index.textile @@ -17,7 +17,7 @@ h2(#create). Create or retrieve a room Users send messages to a room and subscribe to the room in order to receive messages. Other features, such as indicating which users are online, or which users are typing are configured as part of a room's options. blang[javascript,swift]. - A @room@ is created, or an existing one is retrieved from the @rooms@ collection using the "@rooms.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Rooms.html#get"@rooms.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Rooms.html#get method: + A @room@ is created, or an existing one is retrieved from the @rooms@ collection using the "@rooms.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Rooms.html#get"@rooms.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/rooms/get%28roomid%3Aoptions%3A%29 method: blang[react]. The "@ChatRoomProvider@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatRoomProvider.html provides access to a specific chat room to all child components in the component tree. @@ -66,7 +66,7 @@ blang[react]. blang[javascript,swift]. - When you create or retrieve a room using @rooms.get()@, you need to choose which additional chat features you want enabled for that room. This is configured by passing a "@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomOptions.html"@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.RoomOptions.html object as the second argument. In addition to setting which features are enabled, @RoomOptions@ also configures the properties of the associated features, such as the timeout period for typing indicators. + When you create or retrieve a room using @rooms.get()@, you need to choose which additional chat features you want enabled for that room. This is configured by passing a "@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomOptions.html"@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/roomoptions object as the second argument. In addition to setting which features are enabled, @RoomOptions@ also configures the properties of the associated features, such as the timeout period for typing indicators. ```[javascript] const presence = {enter: false}; @@ -122,7 +122,7 @@ Releasing a room allows the underlying resources to be garbage collected or rele Releasing a room may be optional for many applications. If you have multiple transient rooms, such as in the case of a 1:1 support chat, then it is may be more beneficial. blang[javascript,swift]. - Once "@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Rooms.html#release"@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Rooms.html#release has been called, the room will be unusable and a new instance will need to be created using "@rooms.get()@":#create if you want to reuse it. + Once "@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Rooms.html#release"@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/rooms/release%28roomid%3A%29 has been called, the room will be unusable and a new instance will need to be created using "@rooms.get()@":#create if you want to reuse it. ```[javascript] await rooms.release('basketball-stream'); @@ -142,7 +142,7 @@ As soon as a client is attached to a room, Ably will begin streaming messages an blang[javascript,swift]. Once a reference to a room has been created using @rooms.get()@, clients attach to it in order to ensure it is created in the Ably system. - Use the "@attach()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#attach"@attach()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Room.html#attach method on a room to attach to it: + Use the "@attach()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#attach"@attach()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/room/attach%28%29 method on a room to attach to it: blang[react]. By default the @ChatRoomProvider@ will automatically call "@attach()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#attach on the room when it first mounts. Set the "@attach@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.ChatRoomProviderProps.html#attach property to @false@ to manually control the attachment using the "@useRoom@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useRoom.html hook instead. @@ -173,7 +173,7 @@ try await room.attach() h3(#detach). Detach from a room blang[javascript,swift]. - Use the "@detach()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#detach"@detach()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Room.html#detach method on a room to detach from it and stop receiving messages and events: + Use the "@detach()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#detach"@detach()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/room/detach%28%29 method on a room to detach from it and stop receiving messages and events: ```[javascript] await room.detach(); @@ -208,7 +208,7 @@ A room can have any of the following statuses: blang[javascript,swift]. - Use the "@current@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomStatus.html#current"@status@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.RoomStatus.html property to check which status a room is currently in: + Use the "@current@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomStatus.html#current"@status@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/roomstatus property to check which status a room is currently in: blang[react]. Use the @roomStatus@ property to view the current "@Room@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html status changes. The @roomError@ property is its associated error. Any hooks that take an optional listener have these properties available in their response, such as @useMessages@ or @useTyping@. It is more common that you will monitor the room status in the specific feature hooks rather than needing to use @useRoom@. These events are related to the room instance of the nearest "@ChatRoomProvider@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatRoomProvider.html. For example, with the @useMessages@ hook: @@ -243,7 +243,7 @@ let status = try await room.status blang[javascript,swift]. You can also subscribe to room status updates by registering a listener. An event will be emitted whenever the status of the room changes. - Use the "@room.status.onChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomStatus.html#onChange"@room.onStatusChange()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Room.html#onStatusChange method in a room to register a listener for status change updates: + Use the "@room.status.onChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomStatus.html#onChange"@room.onStatusChange()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/room/onstatuschange%28%29-s9g method in a room to register a listener for status change updates: ```[javascript] const { off } = room.onStatusChange((change) => diff --git a/content/chat/rooms/messages.textile b/content/chat/rooms/messages.textile index 6425c8c212..0975e27ec3 100644 --- a/content/chat/rooms/messages.textile +++ b/content/chat/rooms/messages.textile @@ -13,7 +13,7 @@ You can send and receive messages in a chat room with any number of participants h2(#subscribe). Subscribe to messages blang[javascript,swift]. - Subscribe to receive messages in a room by registering a listener. Use the "@messages.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#subscribe"@messages.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Messages.html#subscribe method in a room to receive all messages that are sent to it: + Subscribe to receive messages in a room by registering a listener. Use the "@messages.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#subscribe"@messages.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/messages/subscribe%28%29-360z1 method in a room to receive all messages that are sent to it: blang[react]. Subscribe to messages with the "@useMessages@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useMessages.html hook. Supply a listener and the hook will automatically subscribe to messages sent to the room. As long as a defined value is provided, the subscription will persist across renders. If the listener value is undefined, the subscription will be removed until it becomes defined again. @@ -123,7 +123,7 @@ blang[javascript,swift]. h2(#send). Send a message blang[javascript,swift]. - Use the "@messages.send()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#send"@messages.send()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Messages.html#send method to send a message in a chat room. All users that are "subscribed":#subscribe to messages on that room will receive it: + Use the "@messages.send()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#send"@messages.send()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/messages/send%28params%3A%29 method to send a message in a chat room. All users that are "subscribed":#subscribe to messages on that room will receive it: blang[react]. Use the "@send()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseMessagesResponse.html#send method available from the response of the @useMessages@ hook to to send a message to the room: diff --git a/content/chat/rooms/occupancy.textile b/content/chat/rooms/occupancy.textile index c28653cce6..d5f30740f8 100644 --- a/content/chat/rooms/occupancy.textile +++ b/content/chat/rooms/occupancy.textile @@ -17,7 +17,7 @@ Occupancy enables you to view the number of users currently online in a room. Th h2(#subscribe). Subscribe to room occupancy blang[javascript,swift]. - Subscribe to a room's occupancy by registering a listener. Occupancy events are emitted whenever the number of online users within a room changes. Use the "@occupancy.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Occupancy.html#subscribe"@occupancy.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Occupancy.html#subscribe method in a room to receive updates: + Subscribe to a room's occupancy by registering a listener. Occupancy events are emitted whenever the number of online users within a room changes. Use the "@occupancy.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Occupancy.html#subscribe"@occupancy.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/occupancy/subscribe%28%29-3loon method in a room to receive updates: blang[react]. Subscribe to a room's occupancy with the "@useOccupancy@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useOccupancy.html hook. @@ -125,7 +125,7 @@ h2(#retrieve). Retrieve room occupancy blang[javascript,swift]. The occupancy of a room can be retrieved in one-off calls instead of subscribing to updates. - Use the "@occupancy.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Occupancy.html#get"@occupancy.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Occupancy.html#get method to retrieve the occupancy of a room: + Use the "@occupancy.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Occupancy.html#get"@occupancy.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/occupancy/get%28%29 method to retrieve the occupancy of a room: ```[javascript] const occupancy = await room.occupancy.get(); diff --git a/content/chat/rooms/presence.textile b/content/chat/rooms/presence.textile index 0210341dd4..71701db299 100644 --- a/content/chat/rooms/presence.textile +++ b/content/chat/rooms/presence.textile @@ -17,7 +17,7 @@ Subscribe to the online status of room members using the presence feature. Prese h2(#subscribe). Subscribe to presence blang[javascript,swift]. - Subscribe to users' presence status by registering a listener. Presence events are emitted whenever a member enters or leaves the presence set, or updates their user data. Use the "@presence.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#subscribe"@presence.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Presence.html#subscribe method in a room to receive updates: + Subscribe to users' presence status by registering a listener. Presence events are emitted whenever a member enters or leaves the presence set, or updates their user data. Use the "@presence.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#subscribe"@presence.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/presence/subscribe%28event%3A%29-95gdn method in a room to receive updates: blang[react]. Subscribe to users' presence status with the "@usePresenceListener@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.usePresenceListener.html hook. Supply an optional listener to receive presence status updates, or use the "@presenceData@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UsePresenceListenerResponse.html#presenceData property returned by the hook. @@ -161,7 +161,7 @@ Users can enter and leave the presence set of a room to indicate when they are o blang[javascript,swift]. - Use the "@presence.enter()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#enter"@presence.enter()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Presence.html#enter method to indicate when a user joins a room. This will send a presence event to all users subscribed to presence indicating that a new member has joined the chat. You can also set an optional data field with information such as the status of a user: + Use the "@presence.enter()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#enter"@presence.enter()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/presence/enter%28data%3A%29 method to indicate when a user joins a room. This will send a presence event to all users subscribed to presence indicating that a new member has joined the chat. You can also set an optional data field with information such as the status of a user: blang[react]. Indicate when a user joins a room with the "@usePresence@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.usePresence.html hook. Users will automatically be entered into the presence set when the component mounts. @@ -195,7 +195,7 @@ try await room.presence.enter(data: .init(userCustomData: ["status": .string("On ``` blang[javascript,swift]. - Use the "@presence.update()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#update"@presence.update()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Presence.html#update method when a user wants to update their data, such as an update to their status, or to indicate that they're raising their hand. Updates will send a presence event to all users subscribed to presence: + Use the "@presence.update()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#update"@presence.update()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/presence/update%28data%3A%29 method when a user wants to update their data, such as an update to their status, or to indicate that they're raising their hand. Updates will send a presence event to all users subscribed to presence: blang[react]. Use the "@update()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UsePresenceResponse.html#update property available from the response of the @usePresence@ hook to update a user's data, such as setting their status to 'Away from keyboard'. @@ -231,7 +231,7 @@ try await room.presence.update(data: .init(userCustomData: ["status": .string("B ``` blang[javascript]. - Use the "@presence.leave()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#leave"@presence.leave()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Presence.html#leave method to explicitly remove a user from the presence set. This will send a presence event to all users subscribed to presence. You can also set an optional data field such as setting a status of 'Back later'. + Use the "@presence.leave()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#leave"@presence.leave()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/presence/leave%28data%3A%29 method to explicitly remove a user from the presence set. This will send a presence event to all users subscribed to presence. You can also set an optional data field such as setting a status of 'Back later'. blang[react]. Indicate when a user leaves a room with the "@usePresence@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.usePresence.html hook. Users will automatically be removed from the presence set when the component unmounts. @@ -283,7 +283,7 @@ h2(#retrieve). Retrieve the presence set blang[javascript,swift]. The online presence of users can be retrieved in one-off calls. This can be used to check the status of an individual user, or return the entire presence set as an array. - Use the "@presence.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#get"@presence.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Presence.html#get method to retrieve an array of all users currently entered into the presence set, or individual users: + Use the "@presence.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#get"@presence.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/presence/get%28%29 method to retrieve an array of all users currently entered into the presence set, or individual users: ```[javascript] // Retrieve all users entered into presence as an array: @@ -305,7 +305,7 @@ blang[react]. Use the "@presenceData@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UsePresenceListener.html#presenceData property available from the response of the @usePresence@ hook to view a list of all member's presence status in the room. blang[javascript,swift]. - Alternatively, use the "@presence.isUserPresent()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#isUserPresent"@presence.isUserPresent()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Presence.html#isUserPresent method and pass in a user's @clientId@ to check whether they are online or not. This will return a boolean: + Alternatively, use the "@presence.isUserPresent()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Presence.html#isUserPresent"@presence.isUserPresent()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/presence/isuserpresent%28clientid%3A%29 method and pass in a user's @clientId@ to check whether they are online or not. This will return a boolean: ```[javascript] const isPresent = await room.presence.isUserPresent('clemons123'); diff --git a/content/chat/rooms/reactions.textile b/content/chat/rooms/reactions.textile index 3c9ed97af6..07c65786cd 100644 --- a/content/chat/rooms/reactions.textile +++ b/content/chat/rooms/reactions.textile @@ -19,7 +19,7 @@ Room reactions are ephemeral and not stored or aggregated by Ably. The intention h2(#subscribe). Subscribe to room reactions blang[javascript,swift]. - Subscribe to room reactions by registering a listener. Use the "@reactions.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomReactions.html#subscribe"@reactions.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.RoomReactions.html#subscribe method in a room to receive reactions: + Subscribe to room reactions by registering a listener. Use the "@reactions.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomReactions.html#subscribe"@reactions.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/roomreactions/subscribe%28%29-64gdf method in a room to receive reactions: blang[react]. Subscribe to room reactions with the "@useRoomReactions@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat_react.useRoomReactions.html hook. Supply an optional listener to receive the room reactions. @@ -117,7 +117,7 @@ blang[react,swift]. h2(#send). Send a room reaction blang[javascript,swift]. - Use the "@reactions.send()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomReactions.html#send"@reactions.send()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.RoomReactions.html#send method to send a room-level reaction. The most common way of using this method is to trigger it whenever a user clicks an emoji button in a room: + Use the "@reactions.send()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomReactions.html#send"@reactions.send()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/roomreactions/send%28params%3A%29 method to send a room-level reaction. The most common way of using this method is to trigger it whenever a user clicks an emoji button in a room: blang[react]. Use the "@send()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseRoomReactionsResponse.html#send method available from the response of the @useRoomReactions@ hook to emit an event when a user reacts, for example when they click an emoji button: diff --git a/content/chat/rooms/typing.textile b/content/chat/rooms/typing.textile index 91a92fa3fc..dfe02a59d8 100644 --- a/content/chat/rooms/typing.textile +++ b/content/chat/rooms/typing.textile @@ -17,7 +17,7 @@ Typing indicators enable you to display which users are currently writing a mess h2(#subscribe). Subscribe to typing events blang[javascript,swift]. - Subscribe to typing events by registering a listener. Typing events can be emitted when a user starts typing, and when they stop typing. Use the "@typing.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#subscribe"@typing.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Typing.html#subscribe method in a room to receive these updates: + Subscribe to typing events by registering a listener. Typing events can be emitted when a user starts typing, and when they stop typing. Use the "@typing.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#subscribe"@typing.subscribe()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/typing/subscribe%28%29-7uox7 method in a room to receive these updates: blang[react]. Subscribe to typing events with the "@useTyping@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useTyping.html hook. Supply an optional listener to receive the typing events, or use the "@currentlyTyping@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseTypingResponse.html#currentlyTyping property returned by the hook to access the list of those users that are currently typing. @@ -117,7 +117,7 @@ blang[javascript,swift]. h2(#set). Set typing status blang[javascript,swift]. - Use the "@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#start"@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Typing.html#start method to emit a typing event with @isTyping@ set to @true@. + Use the "@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#start"@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/typing/start%28%29 method to emit a typing event with @isTyping@ set to @true@. blang[react]. Use the "@start()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseTypingResponse.html#start method available from the response of the @useTyping@ hook to emit an event when a user has started typing. @@ -152,7 +152,7 @@ try await room.typing.start() ``` blang[javascript,swift]. - Use the "@stop()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#stop"@stop()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Typing.html#stop method to emit a typing event with @isTyping@ set to @false@. + Use the "@stop()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#stop"@stop()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/typing/stop%28%29 method to emit a typing event with @isTyping@ set to @false@. blang[react]. Use the "@stop()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseTypingResponse.html#stop method available from the response of the @useTyping@ hook to emit an event when a user has stopped typing. @@ -186,7 +186,7 @@ try await room.typing.stop() h2(#retrieve). Retrieve a list of users that are currently typing blang[javascript,swift]. - Use the "@typing.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#get"@typing.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Typing.html#get method to retrieve a set of @clientId@s for all users that are currently typing in the room: + Use the "@typing.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#get"@typing.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/typing/get%28%29 method to retrieve a set of @clientId@s for all users that are currently typing in the room: ```[javascript] const currentlyTypingClientIds = await room.typing.get();