|
@@ -6,8 +6,7 @@ const { PeerConnection, Video } = require('node-datachannel');
|
|
|
const { createSocket } = require('dgram')
|
|
const { createSocket } = require('dgram')
|
|
|
const { spawn } = require('child_process')
|
|
const { spawn } = require('child_process')
|
|
|
|
|
|
|
|
-// const url = 'ws://10.10.3.196:7896'
|
|
|
|
|
-const url = process.argv.splice(2);
|
|
|
|
|
|
|
+const url = 'ws://10.10.3.196:7896'
|
|
|
class CarServer {
|
|
class CarServer {
|
|
|
constructor() {
|
|
constructor() {
|
|
|
this.Peer = null
|
|
this.Peer = null
|
|
@@ -44,7 +43,7 @@ class CarServer {
|
|
|
} else if (data.type === 'startRTC') {
|
|
} else if (data.type === 'startRTC') {
|
|
|
this.startVideo()
|
|
this.startVideo()
|
|
|
} if (data.type === 'conctrl') {
|
|
} if (data.type === 'conctrl') {
|
|
|
- const state = this.Peer.iceConnectionState;
|
|
|
|
|
|
|
+ const state = this.Peer.state();
|
|
|
if(state === 'connected') PWM.changPWM(data.conctrl);
|
|
if(state === 'connected') PWM.changPWM(data.conctrl);
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -106,4 +105,4 @@ class CarServer {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-new CarServer(url[0])
|
|
|
|
|
|
|
+new CarServer()
|