mirror of
https://github.com/xtr-dev/rondevu-demo.git
synced 2025-12-15 12:33:23 +00:00
Update test script to use same API URL and service version as demo
- Use api.ronde.vu instead of rondevu.xtrdev.workers.dev - Use chat:2.0.0 instead of chat:1.0.0 to match demo
This commit is contained in:
@@ -2,37 +2,41 @@
|
|||||||
/**
|
/**
|
||||||
* Test script to connect to @bas's chat service and send a "hello" message
|
* Test script to connect to @bas's chat service and send a "hello" message
|
||||||
*
|
*
|
||||||
* Setup:
|
* IMPORTANT: This script requires the 'wrtc' package which must be installed separately.
|
||||||
* npm install --save-optional wrtc
|
* See TEST_README.md for detailed installation instructions.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Quick start:
|
||||||
* node test-connect.js
|
* npm install wrtc
|
||||||
|
* npm test
|
||||||
*
|
*
|
||||||
* Requires:
|
* Requirements:
|
||||||
* - Node.js 19+ or Node.js 18 with --experimental-global-webcrypto
|
* - Node.js 19+ (or Node.js 18 with --experimental-global-webcrypto)
|
||||||
* - wrtc package (install with: npm install wrtc)
|
* - wrtc package (requires native compilation)
|
||||||
|
* - Build tools (python, make, g++)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Rondevu, RondevuSignaler, NodeCryptoAdapter } from '@xtr-dev/rondevu-client'
|
import { Rondevu, RondevuSignaler, NodeCryptoAdapter } from '@xtr-dev/rondevu-client'
|
||||||
|
|
||||||
// Try to import wrtc, provide helpful error if not found
|
// Import wrtc
|
||||||
let RTCPeerConnection
|
let wrtc
|
||||||
try {
|
try {
|
||||||
const wrtc = await import('wrtc')
|
wrtc = await import('wrtc')
|
||||||
RTCPeerConnection = wrtc.default.RTCPeerConnection
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Error: wrtc package not found')
|
console.error('❌ Error: wrtc package not found or failed to load')
|
||||||
console.error('\nThe wrtc package is required for WebRTC support in Node.js.')
|
console.error('\nThe wrtc package is required for WebRTC support in Node.js.')
|
||||||
console.error('Install it with:')
|
console.error('Install it with:')
|
||||||
console.error('\n npm install wrtc')
|
console.error('\n npm install wrtc')
|
||||||
console.error('\nNote: wrtc requires native compilation and may take a few minutes to install.')
|
console.error('\nNote: wrtc requires native compilation and may take a few minutes to install.')
|
||||||
|
console.error('\nError details:', error.message)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { RTCPeerConnection } = wrtc
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
const API_URL = 'https://rondevu.xtrdev.workers.dev'
|
const API_URL = 'https://api.ronde.vu'
|
||||||
const TARGET_USER = 'bas'
|
const TARGET_USER = 'bas'
|
||||||
const SERVICE_FQN = `chat:1.0.0@${TARGET_USER}`
|
const SERVICE_FQN = `chat:2.0.0@${TARGET_USER}`
|
||||||
const MESSAGE = 'hello'
|
const MESSAGE = 'hello'
|
||||||
|
|
||||||
// TURN server configuration
|
// TURN server configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user