-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support WebRTC communication #126
Conversation
billfort
commented
May 6, 2024
- Support WebRTC communication in browser environment;
- WebSocket is reserved;
- Both WebRTC and WebSocket are compatible;
Signed-off-by: billfort <fxbao@hotmail.com>
this.dc.send(data); | ||
} | ||
|
||
constructor(stunServerAddr){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend we support multiple stun server for reliability
@@ -91,6 +100,8 @@ export default class Client { | |||
rpcServerAddr?: string, | |||
tls?: boolean, | |||
worker?: boolean | () => Worker | Promise<Worker>, | |||
stunServerAddr?: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend we support multiple stun server for reliability
@@ -8,6 +8,8 @@ export const defaultOptions = { | |||
encrypt: true, | |||
rpcServerAddr: 'https://mainnet-rpc-node-0001.nkn.org/mainnet/api/wallet', | |||
worker: false, | |||
stunServerAddr: 'stun:stun.l.google.com:19302', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend we use all 3 by default:
[
"stun:stun.l.google.com:19302",
"stun:stun.cloudflare.com:3478",
"stun:stunserver.stunprotocol.org:3478",
]
<script src="../dist/nkn.js"></script> | ||
<body> | ||
<h1>WebRTC example</h1> | ||
<button onclick="startClients()">Start WebRTC Clients, Alic and Bob</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Alice