Skip to content

Commit 84662cd

Browse files
committed
Update SDK method from start to keystroke for typing events
1 parent 4556d08 commit 84662cd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

content/chat/rooms/typing.textile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,28 +133,28 @@ blang[react,swift,kotlin].
133133
h2(#set). Set typing status
134134

135135
blang[javascript,swift,kotlin].
136-
Use the <span lang="javascript">"@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#start</span><span lang="swift">"@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/typing/start%28%29</span><span lang="kotlin">"@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-typing/start.html</span> method to emit a typing event with @isTyping@ set to @true@.
136+
Use the <span lang="javascript">"@typing.keystroke()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Typing.html#start</span><span lang="swift">"@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/typing/start%28%29</span><span lang="kotlin">"@typing.start()@":https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-typing/start.html</span> method to emit a typing event with @type@ set to @typing.started@.
137137

138138
blang[react].
139-
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.
139+
Use the "@keystroke()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseTypingResponse.html#keystroke method available from the response of the @useTyping@ hook to emit an event when a user has started typing.
140140

141141
```[javascript]
142-
await room.typing.start();
142+
await room.typing.keystroke();
143143
```
144144

145145
```[react]
146146
import { useTyping } from '@ably/chat';
147147

148148
const MyComponent = () => {
149-
const { start, currentlyTyping, error } = useTyping();
150-
const handleStartClick = () => {
151-
start();
149+
const { keystroke, currentlyTyping, error } = useTyping();
150+
const handleKeystrokeClick = () => {
151+
keystroke();
152152
};
153153

154154
return (
155155
<div>
156156
{error && <p>Typing Error: {error.message}</p>}
157-
<button onClick={handleStartClick}>Start Typing</button>
157+
<button onClick={handleKeystrokeClick}>Start Typing</button>
158158
<p>Currently typing: {currentlyTyping.join(', ')}</p>
159159
</div>
160160
);
@@ -208,17 +208,17 @@ room.typing.stop()
208208
h3(#frequency). Typing Event Frequency
209209

210210
The Typing feature includes a configurable timer that controls how often typing events are sent to the server. This timer is reset each time a new typing event is sent, it works as follows:
211-
- On the **first call** to @start()@, the timer is set and an event is sent to the server.
211+
- On the **first call** to @keystroke()@, the timer is set and an event is sent to the server.
212212
- **Subsequent calls** before the timer expires result in a no-op.
213213
- After the timer expires, a new typing event is sent and the timer is reset.
214214
- If @stop()@ is called, the timer is reset and a @typing.stopped@ event is sent to the server.
215215

216216
You can configure the length of this timer using the @heartbeatThrottleMs@ parameter in @RoomOptions@ (default: **10,000ms**).
217-
It is recommended that you call @start()@ with every keypress, and the SDK will handle when and if to send a typing indicator to the server.
217+
It is recommended that you call @keystroke()@ with every keypress, and the SDK will handle when and if to send a typing indicator to the server.
218218

219219
h3(#emulating-heartbeats). Emulating User Behavior
220220

221-
If needed, you can emulate user behavior (e.g., in chatbots) by setting a timeout to call @start()@ at intervals equal to the @heartbeatThrottleMs@ plus a small delay, e.g. 200ms. This will ensure the typing indicator remains active.
221+
You can emulate user behavior (e.g., in chatbots) by setting a timeout to call @keystroke()@ at intervals equal to the @heartbeatThrottleMs@ plus a small delay, e.g. 200ms. This will ensure the typing indicator remains active.
222222

223223
h3(#grace-period). Grace Period for Typing Events
224224

0 commit comments

Comments
 (0)