Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
@messagebird/webrtc
Advanced tools
To enable your application to make and receive calls over WebRTC, you have to instantiate a new WebRTCClient (TODO: good name? Device). To instantiate a client and authenticate with your MessageBird account you need to generate a JWT and pass it to the client (docs)
const client = new WebRTCClient({
username: 'test',
jwt: 'test',
});
// Open a connection to the MessageBird WebRTC API
client
.connect()
.then(() => {
// Ready to start and receive WebRTC connections.
})
.catch(error => {
// Error making a connection. The error object contains details of the failure.
});
Make sure you've instantiated the WebRTCClient
and opened the connection by calling the .connect()
method. After succesfully instantiating a new client you can start new RTC sessions by calling the starRTCSession
method. (todo: better naming? connect/setup/call
? )
client
.startAudioCall({
to: '+31612345678', // TODO: This will become `flowId` probably?
onEnded() {
console.log('session was ended');
},
})
.then(connection => {
// resolves with an `RTCConnection` object (docs)
})
.catch(error => {
// Failed to start a session, error object contains details.
});
Your app can handle incoming RTC connections by handling the on('incoming')
event.
client.on('incoming', connection => {
connection.accept(); // Accept the incoming connection and start a call
connection.disconnect(); // Reject the incoming connection.
});
Check out the TS Typings: https://gitlab.messagebird.io/frontend/javascript-webrtc-sdk/tree/master/types
constructor(options)
Creates a new instance of the WebRTCClient. Accepts an options object with the following properties:
sip:{username}@webrtc-staging.messagebird.io
)connect()
Connect the WebRTCClient to start making outbound calls or listen for incoming sessions
startAudioCall(options)
Start a new outgoing RTC session. Accepts an options object with the following properties:
to The recipient to connect to. TODO: Should become flowId
?
onEnded Function that will be called when the session ends. (disconnected by user or remote)
returns a promise that resolves with an RTCSession
when the call is started. Rejects if starting the connection failed.
on('connected', handler)
When the client connects. Can be called multiple times in case the client disconnects and automatically reconnects.
on('disconnected', handler)
When the client disconnects for a certain reason. (docs on data object with reason)
on('incoming', handler)
Fired when an incoming RTC session is received. Callback contains an RTCSession
object.
client.on('incoming', incomingSession => {
// Accept the incoming call
incomingSession.accept();
});
The RTCSession
object describes an ongoing RTC session. You will never instantiate an RTCSession
yourself, the SDK will take care of that for you.
disconnect()
Disconnects the client from the RTC session (todo: maybe rename?)
on(name, handler)
Bind a new event listener. See Events (link) below
removeEventListener(name, handler)
Removes an event listener
on('confirmed')
Fired when an outgoing session is confirmed by the other party (todo: how does this behave with ringing state?)
on('failed')
Fired when an RTC session fails. Callback contains an error object with details
on('ended')
Fired when an RTC session ends normally (todo: "normally"? How does this work if remote hangs up)
IncomingRTCSession extends everything from RTCSession, but has some additional features
acccept()
Accept an incoming connection to start a call.
FAQs
Documentation can be found at https://developers.messagebird.com/docs/webrtc
The npm package @messagebird/webrtc receives a total of 3 weekly downloads. As such, @messagebird/webrtc popularity was classified as not popular.
We found that @messagebird/webrtc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 38 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.