I am trying to implement some very simple UDP communication between two clients (Server.js and Index.js), both using Peer.js (Peerjs-on-Node) and Node.js.
Index.js is as follows:
const Peer = require('peerjs-on-node').Peer;
var peer = new Peer("c48ce5c1-364b-4e82-aa5c-19fe05f6a61f");
const conn = peer.connect("02addcc4-bba1-46e4-8ed6-a210e179f732");
conn.on("open", () => {
conn.send("Hi!");
});
while Server.js is:
const Peer = require('peerjs-on-node').Peer;
var peer = new Peer("02addcc4-bba1-46e4-8ed6-a210e179f732");
peer.on("connection", (conn) => {
conn.on("data", (data) => {
console.log(data);
});
});
The peer id's are static (randomly generated for this example).
I get no obvious errors when running the above, but also no expected output.
Can anyone diagnose? I thought I'd stripped this back to the simplest variation I could but still no success.