geckosio / geckos.io

🦎 Real-time client/server communication over UDP using WebRTC and Node.js http://geckos.io
BSD 3-Clause "New" or "Revised" License
1.34k stars 84 forks source link

ReferenceError: RTCPeerConnection is not defined #288

Open rockey2020 opened 4 months ago

rockey2020 commented 4 months ago

Describe the bug A clear and concise description of what the bug is.

const channel = geckos({ port: 10086, url: "localhost" });
  channel.onConnect((err) => {
    console.log(err);
  });

Have a question? Join the discussions instead.

I get this problem when I use client in node.js 21

Geckos.io signaling server is running on port 10086 file:///Users/rockey/WebstormProjects/darwin.node/node_modules/@geckos.io/client/lib/wrtc/peerConnection.js:5 const webRTCPcSupported = RTCPeerConnection || webkitRTCPeerConnection; // eslint-disable-line no-undef ^

ReferenceError: RTCPeerConnection is not defined at PeerConnection.connect (file:///Users/rockey/WebstormProjects/darwin.node/node_modules/@geckos.io/client/lib/wrtc/peerConnection.js:5:35) at ClientChannel.onConnect (file:///Users/rockey/WebstormProjects/darwin.node/node_modules/@geckos.io/client/lib/geckos/channel.js:86:52) at startClient (file:///Users/rockey/WebstormProjects/darwin.node/apps/anynat/src/service/client/index.ts:4:13) at at async file:///Users/rockey/WebstormProjects/darwin.node/apps/anynat/src/index.ts:17:5

Node.js v21.7.3

yandeu commented 3 months ago

It looks like node-datachannel does not yet support Node.js v21: https://github.com/murat-dogan/node-datachannel?tab=readme-ov-file#supported-platforms