Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"spaces-member-location-react": "yarn workspace spaces-member-location-react dev"
},
"dependencies": {
"@ably/chat": "^0.9.0",
"@ably/chat": "^0.10.0",
"@ably/spaces": "^0.4.0",
"ably": "^2.9.0",
"cors": "^2.8.5",
Expand Down
9 changes: 5 additions & 4 deletions examples/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# yarn lockfile v1


"@ably/chat@^0.9.0":
version "0.9.0"
resolved "https://registry.yarnpkg.com/@ably/chat/-/chat-0.9.0.tgz#8d43baf891d51ba796c74c5d950b59641e0405cd"
integrity sha512-8d2bbJTYfrSyuYW1jqFGuY0sdi8XmSlri6h9TAW7RlMglbSmQ6hXNHRbyvNf4FOF6ttvIjPRHpglmWMFC7MCoA==
"@ably/chat@^0.10.0":
version "0.10.0"
resolved "https://registry.yarnpkg.com/@ably/chat/-/chat-0.10.0.tgz#10a90c76726ea535a0a7847a786d3d06f44bafbc"
integrity sha512-74T/XAiYQkrNkRVcV18jnUjEiH23K3lOgt4yrZ0MXta0QJ9iWhqnemlmL+IDT9i/bN57AuhNXOVn8RdSSHjHnw==
dependencies:
async-mutex "^0.5.0"
dequal "^2.0.3"
Expand Down Expand Up @@ -2643,6 +2643,7 @@ statuses@2.0.1:
integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
name string-width-cjs
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down
4 changes: 2 additions & 2 deletions src/data/languages/languageData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export default {
chat: {
javascript: '0.10',
react: '0.10',
swift: '0.4',
kotlin: '0.3',
swift: '0.6',
kotlin: '0.5',
},
spaces: {
javascript: '0.4',
Expand Down
33 changes: 8 additions & 25 deletions src/pages/docs/chat/rooms/reactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ const MyComponent = () => {
```swift
let reactionSubscription = room.reactions.subscribe()
for await event in reactionSubscription {
print("Received a reaction of type \(event.reaction.type), and metadata \(event.reaction.metadata)")
print("Received a reaction of name \(event.reaction.name), and metadata \(event.reaction.metadata)")
}
```

```kotlin
val subscription = room.reactions.subscribe { event: RoomReactionEvent ->
println("received a ${event.reaction.type} with metadata ${event.reaction.metadata}")
println("Received a reaciton of name ${event.reaction.name} with metadata ${event.reaction.metadata}")
}
```
</Code>
Expand All @@ -56,8 +56,6 @@ val subscription = room.reactions.subscribe { event: RoomReactionEvent ->

The following are the properties of a room reaction event:

<If lang="javascript,react">

| Property | Description | Type |
| -------- | ----------- | ---- |
| type | The type of reaction event. | String |
Expand All @@ -69,21 +67,6 @@ The following are the properties of a room reaction event:
| | `clientId`: The client identifier of the user that sent the reaction. | String |
| | `isSelf`: Will be `true` for the user that sent the reaction. | Boolean |

</If>

<If lang="kotlin,swift">

| Property | Description | Type |
| -------- | ----------- | ---- |
| type | The type of reaction, for example a 'like' or a heart emoji. | String |
| headers | Optional headers for adding additional information to a reaction. | Object |
| metadata | Optional metadata about the reaction, such as an animation or effect. This information is not read by Ably. | Object |
| createdAt | The time the reaction was sent. | Date |
| clientId | The client identifier of the user that sent the reaction. | String |
| isSelf | Will be `true` for the user that sent the reaction. | Boolean |

</If>

### Unsubscribe from room reactions <a id="unsubscribe"/>

<If lang="javascript">
Expand All @@ -106,8 +89,8 @@ When you unmount the component that is using the `useRoomReactions` hook, it wil
<Code>
```javascript
// Initial subscription
const {unsubscribe} = room.reactions.subscribe((reaction) => {
console.log(`Received a reaction of type ${reaction.type}, and metadata ${reaction.metadata}`);
const {unsubscribe} = room.reactions.subscribe((event) => {
console.log(`Received a reaction of type ${event.reaction.name}, and metadata ${event.reaction.metadata}`);
});

// To remove the listener
Expand Down Expand Up @@ -156,15 +139,15 @@ const MyComponent = () => {
```

```swift
try await room.reactions.send(params: .init(type: "like"))
try await room.reactions.send(params: .init(name: "like"))

try await room.reactions.send(params: .init(type: "heart",
try await room.reactions.send(params: .init(name: "heart",
metadata: ["effect": "fireworks"]))
```

```kotlin
room.reactions.send(type = "like")
room.reactions.send(type = "heart", metadata = JsonObject().apply {
room.reactions.send(name = "like")
room.reactions.send(name = "heart", metadata = JsonObject().apply {
addProperty("effect", "fireworks")
})
```
Expand Down