Skip to content

Commit 2b034e7

Browse files
committed
wait for reply added
1 parent ed50977 commit 2b034e7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/api/Chat/waitforReply.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
chat - waitforReply
1+
### waitforReply
22

3+
Sends a message through a websocket and waits for a specific type of response. This function sends a JSON-formatted request and listens for a response. It returns a promise that resolves with the response data when a message of type `messageResponse` is received.
34

5+
#### Syntax
46

7+
```javascript
8+
codebolt.chat.waitforReply(message: string): Promise<any>
9+
```
10+
11+
#### Returns
12+
13+
Returns a `Promise` that resolves with the response data when a message of type `messageResponse` is received from the websocket.
14+
15+
#### Example
16+
17+
```javascript
18+
// Sending a message and handling the response
19+
await codebolt.chat.waitforReply("Requesting info");
20+
//User can see this message on their UI and when user send a reply this prmoise resolves
21+
```

0 commit comments

Comments
 (0)