diff --git a/web-service/server/src/public/index.html b/web-service/server/src/public/index.html index d90dc6f9d6d13b7c7e94e08542452cabe1eb8493..8456f778f6a5e5c05f191244eb23d714cbf12334 100644 --- a/web-service/server/src/public/index.html +++ b/web-service/server/src/public/index.html @@ -10,6 +10,6 @@ </body> <script src="./js/lib/libde265.min.js"></script> <script src="./js/lib/msgpack5.min.js"></script> - <script src="../peer.js"></script> + <script type="application/javascript" src="./../peer.js"></script> <script src="./js/index.js"></script> </html> \ No newline at end of file diff --git a/web-service/server/src/public/js/index.js b/web-service/server/src/public/js/index.js index d4e1c5ffad0b56ba2d1691c67287a082b0c9f325..eb5e54580882333daf91d71bc65622528445ffcc 100644 --- a/web-service/server/src/public/js/index.js +++ b/web-service/server/src/public/js/index.js @@ -132,7 +132,7 @@ const createCard = (url, viewers) => { const connectToStream = () => { const ws = new WebSocket('ws://localhost:8080/'); let p = new Peer(ws); - p.send('connect', [0,'__handshake__']) + p.send('message', ([0,'__handshake__'])); current_data.frames = 10; //setTimeout 1s, ask for the amount of frames user has selected diff --git a/web-service/server/src/public/js/lib/Peer.js b/web-service/server/src/public/js/lib/Peer.js index e82165e5a07b5337c019a934f8e5858285ed5f21..ff14903ac4a68a0994e3973817c22d18f8ae0267 100644 --- a/web-service/server/src/public/js/lib/Peer.js +++ b/web-service/server/src/public/js/lib/Peer.js @@ -6,6 +6,10 @@ const kConnecting = 1; const kConnected = 2; const kDisconnected = 3; +// Generate a unique id for this webservice +// let my_uuid = new Uint8Array(16); +// my_uuid[0] = 44; +// my_uuid = Buffer.from(my_uuid); const kMagic = 0x0009340053640912; const kVersion = 0; @@ -29,7 +33,9 @@ function Peer(ws) { this.name = "unknown"; this.master = false; - this.sock.on("message", (raw) => { + console.log(this.sock.send("message")); + + this.sock.send("message", (raw) => { // console.log(raw) let msg = decode(raw); console.log("MSG", msg) @@ -77,9 +83,10 @@ function Peer(ws) { } }); - this.send("__handshake__", kMagic, kVersion); + this.send("__handshake__", kMagic, kVersion, /*[my_uuid]*/); } +// Peer.uuid = my_uuid; /** * @private