rdh-socket-client 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# RDH Socket Client
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
To install the RDH Socket Client package, run the following command in your command line:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i rdh-socket-client
|
|
9
|
+
|
|
10
|
+
## USAGE
|
|
11
|
+
|
|
12
|
+
import rdhClientSocket from 'rdh-client-socket';
|
|
13
|
+
|
|
14
|
+
// Initialize the client with your app ID and app key
|
|
15
|
+
const client = new rdhClientSocket({
|
|
16
|
+
app_id: 'APP_ID',
|
|
17
|
+
app_key: 'APP_key'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Subscribe to a channel and listen for an event
|
|
21
|
+
client.channel('channelName').on('eventName', (data) => {
|
|
22
|
+
console.log(data.message);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Emit a custom event with data
|
|
26
|
+
client.emit('myEvent', mydata);
|