mirror of
https://gitlab.com/comunic/nodejs-webrtcsignalexchangerserver
synced 2024-11-25 14:59:27 +00:00
35 lines
854 B
JavaScript
35 lines
854 B
JavaScript
/**
|
|
* Node Signal Exchanger test client
|
|
*
|
|
* @author Pierre HUBERT
|
|
*/
|
|
|
|
const Config = {
|
|
port: 8081,
|
|
server_name: "localhost",
|
|
clientID: location.href.toString().includes("#1") ? "client-1" : "client-2",
|
|
otherPeerID: location.href.toString().includes("#1") ? "client-2" : "client-1"
|
|
};
|
|
|
|
let client = new SignalExchangerClient(
|
|
Config.server_name,
|
|
Config.port,
|
|
Config.clientID
|
|
);
|
|
|
|
client.onConnected = function(){
|
|
console.log("Connected to signal exchanger server.");
|
|
|
|
client.sendSignal(
|
|
Config.otherPeerID,
|
|
"A signal content from " + Config.clientID + " to " + Config.otherPeerID,
|
|
);
|
|
}
|
|
|
|
client.onError = function() {
|
|
console.error("An error occurred with the connection to the signal exchanger server");
|
|
}
|
|
|
|
client.onClosed = function() {
|
|
console.log("Connection to server closed.");
|
|
} |