Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/docs/chat/getting-started/react-native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ You can also use the Ably CLI to enter the room from another client by running t
## Step 9: Send a reaction <a id="step-9"/>

Clients can send a reaction to a room to show their sentiment for what is happening, such as a point being scored in a sports game.
Ably Chat provides a [`useReactions()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useReactions.html) hook to send and receive reactions in a room. These are short-lived (ephemeral) and are not stored in the room history.
Ably Chat provides a [`useRoomReactions()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useRoomReactions.html) hook to send and receive reactions in a room. These are short-lived (ephemeral) and are not stored in the room history.

In your `ChatApp.tsx` file, add a new component called `ReactionComponent`, like so:

Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/chat/getting-started/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ You can also use the Ably CLI to enter the room from another client by running t
## Step 9: Send a room reaction <a id="step-9"/>

Clients can send a reaction to a room to show their sentiment for what is happening, such as a point being scored in a sports game.
Ably Chat provides a [`useReactions()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useReactions.html) hook to send and receive reactions in a room. These are short-lived (ephemeral) and are not stored in the room history.
Ably Chat provides a [`useRoomReactions()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useRoomReactions.html) hook to send and receive reactions in a room. These are short-lived (ephemeral) and are not stored in the room history.

In your `src/App.tsx` file, add a new component called `ReactionComponent`, like so:

Expand Down
8 changes: 4 additions & 4 deletions src/pages/docs/chat/getting-started/swift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ struct ContentView: View {
guard !newMessage.isEmpty, let room = room else { return }

do {
_ = try await room.messages.send(params: .init(text: newMessage))
_ = try await room.messages.send(withParams: .init(text: newMessage))
newMessage = ""
} catch {
print("Failed to send message: \(error)")
Expand Down Expand Up @@ -480,7 +480,7 @@ struct ContentView: View {
guard !newMessage.isEmpty, let room = room else { return }

do {
_ = try await room.messages.send(params: .init(text: newMessage))
_ = try await room.messages.send(withParams: .init(text: newMessage))
newMessage = ""
} catch {
print("Failed to send message: \(error)")
Expand All @@ -492,7 +492,7 @@ struct ContentView: View {

do {
let updateMessageParams = UpdateMessageParams(text: newMessage)
_ = try await room.messages.update(withSerial: editingMessage.serial params: updateMessageParams, details: nil)
_ = try await room.messages.update(withSerial: editingMessage.serial, params: updateMessageParams, details: nil)
self.editingMessage = nil
newMessage = ""
} catch {
Expand Down Expand Up @@ -840,7 +840,7 @@ struct ContentView: View {
guard let room = room else { return }

do {
try await room.reactions.send(params: .init(name: name))
try await room.reactions.send(withParams: .init(name: name))
} catch {
print("Failed to send reaction: \(error)")
}
Expand Down
12 changes: 6 additions & 6 deletions src/pages/docs/chat/react-ui-kit/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,11 @@ import { MessageInput } from '@ably/chat-react-ui-kit';
import { useMessages } from '@ably/chat/react';

// Basic usage
const { send } = useMessages();
const { sendMessage } = useMessages();

const handleSendMessage = (text: string) => {
console.log(`Sending message: ${text}`);
send({ text });
sendMessage({ text });
};

<MessageInput
Expand Down Expand Up @@ -532,25 +532,25 @@ import { ChatMessage } from '@ably/chat-react-ui-kit';
import { Message } from '@ably/chat';
import { useMessages } from '@ably/chat/react';

const { update, deleteMessage, addReaction, removeReaction } = useMessages();
const { updateMessage, deleteMessage, sendReaction, deleteReaction } = useMessages();

<ChatMessage
message={message}
onEdit={(message: Message, newText: string) => {
console.log(`Editing message with serial: ${message.serial}, setting text to: ${newText}`);
update(message.serial, { text: newText });
updateMessage(message.serial, { text: newText });
}}
onDelete={(message: Message) => {
console.log(`Deleting message with serial: ${message.serial}`);
deleteMessage(message.serial);
}}
onReactionAdd={(message: Message, emoji: string) => {
console.log(`Adding reaction ${emoji} to message with serial: ${message.serial}`);
addReaction(message.serial, emoji);
sendReaction(message.serial, { name: emoji });
}}
onReactionRemove={(message: Message, emoji: string) => {
console.log(`Removing reaction ${emoji} from message with serial: ${message.serial}`);
removeReaction(message.serial, emoji);
deleteReaction(message.serial, { name: emoji });
}}
/>
```
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/chat/rooms/history.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const MyComponent = () => {
```

```swift
let paginatedResult = try await room.messages.history(withOptions: .init(orderBy: .newestFirst))
let paginatedResult = try await room.messages.history(withParams: .init(orderBy: .newestFirst))
print(paginatedResult.items)
if let next = try await paginatedResult.next {
print(next.items)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/chat/rooms/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const room = await chatClient.rooms.get('basketball-stream', options);
```

```swift
let presence = PresenceOptions(enter: false)
let presence = PresenceOptions(enableEvents: false)
let typing = TypingOptions(heartbeatThrottle: 5.0) // seconds
// using defaults for reactions and occupancy
let options = RoomOptions(presence: presence, typing: typing, occupancy: .init())
Expand Down
Loading