vivox-sdk-node 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/README.md +21 -16
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -24,34 +24,39 @@ npm install vivox-sdk-node
24
24
 
25
25
  *Note: The native addon will automatically compile during installation if build tools (Python, Visual Studio/C++) are available.*
26
26
 
27
+ ## Connection Flow
28
+
29
+ Vivox requires a specific sequence of operations. You **must** create a connector before attempting to login.
30
+
31
+ 1. **Initialize:** Call `vivox.initialize()`.
32
+ 2. **Setup Listeners:** Listen for `connectorCreated`, `loginSuccess`, and `joinSuccess`.
33
+ 3. **Create Connector:** Call `vivox.connectorCreate(serverUrl)`.
34
+ 4. **Login:** Inside the `connectorCreated` event, call `vivox.login()` or `vivox.loginAnonymous()`.
35
+ 5. **Join:** Inside the `loginSuccess` event, call `vivox.joinChannel()`.
36
+
27
37
  ## Quick Start
28
38
 
29
39
  ```javascript
30
40
  const vivox = require('vivox-sdk-node');
31
- const { VivoxUtils, VivoxError, VivoxLoginState } = require('vivox-sdk-node');
41
+ const { VivoxUtils, VivoxError } = require('vivox-sdk-node');
32
42
 
33
- // 1. Initialize the SDK
34
43
  vivox.initialize();
35
44
 
36
- // 2. Setup Event Listeners
37
- vivox.on('loginStateChange', (data) => {
38
- console.log(`Login State: ${VivoxUtils.getLoginStateName(data.state)}`);
39
- });
40
-
41
- vivox.on('joinSuccess', (event) => {
42
- console.log('Successfully joined the channel!');
43
-
44
- // Set local mic volume to 100%
45
- vivox.setLocalMicVolume(100);
45
+ // Step 1: Wait for connector
46
+ vivox.on('connectorCreated', (event) => {
47
+ if (event.status === VivoxError.VX_E_SUCCESS) {
48
+ // Step 2: Login
49
+ vivox.loginAnonymous("main_connector", accountUri, LOGIN_TOKEN);
50
+ }
46
51
  });
47
52
 
48
- vivox.on('message', (m) => {
49
- console.log(`[CHAT] ${m.participant_uri}: ${m.message}`);
53
+ vivox.on('loginSuccess', (event) => {
54
+ // Step 3: Join Channel
55
+ vivox.joinChannel(accountUri, channelUri, CHANNEL_TOKEN);
50
56
  });
51
57
 
52
- // 3. Create Connector and Start Flow
58
+ // Start the flow
53
59
  vivox.connectorCreate("https://your-vivox-server.com/app", "main_connector");
54
- // After connectorCreated event, call vivox.loginAnonymous() or vivox.login()
55
60
  ```
56
61
 
57
62
  ## Local Moderation Examples
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vivox-sdk-node",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "High-performance, type-safe Node.js wrapper for the Vivox SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",