Gathering detailed insights and metrics for @telnyx/react-client
Gathering detailed insights and metrics for @telnyx/react-client
Gathering detailed insights and metrics for @telnyx/react-client
Gathering detailed insights and metrics for @telnyx/react-client
npm install @telnyx/react-clientTypescript
Module System
Min. Node Version
Node Version
NPM Version
70.5
Supply Chain
93.3
Quality
81
Maintenance
100
Vulnerability
100
License
webrtc@2.22.17
Updated on Aug 11, 2025
webrtc@2.22.16
Updated on Aug 04, 2025
webrtc@2.22.15
Updated on Jul 24, 2025
webrtc@2.22.14
Updated on Jul 09, 2025
webrtc@2.22.13
Updated on Jul 04, 2025
webrtc@2.22.12
Updated on May 20, 2025
TypeScript (99.34%)
JavaScript (0.59%)
CSS (0.04%)
Shell (0.02%)
Total Downloads
59,974
Last Day
89
Last Week
1,748
Last Month
6,713
Last Year
38,011
MIT License
46 Stars
703 Commits
21 Forks
9 Watchers
28 Branches
19 Contributors
Updated on Aug 11, 2025
Latest Version
1.0.2
Package Id
@telnyx/react-client@1.0.2
Unpacked Size
63.29 kB
Size
10.79 kB
File Count
18
NPM Version
6.14.18
Node Version
14.21.3
Published on
Nov 17, 2023
Cumulative downloads
Total Downloads
Last Day
0%
89
Compared to previous day
Last Week
-5.2%
1,748
Compared to previous week
Last Month
8%
6,713
Compared to previous month
Last Year
354.6%
38,011
Compared to previous year
3
25
React wrapper for Telnyx Client
1npm install --save @telnyx/react-client @telnyx/webrtc
1// App.jsx 2import { TelnyxRTCProvider } from '@telnyx/react-client'; 3 4function App() { 5 const credential = { 6 login_token: 'mytoken', 7 }; 8 9 return ( 10 <TelnyxRTCProvider credential={credential}> 11 <Phone /> 12 </TelnyxRTCProvider> 13 ); 14}
1// Phone.jsx 2import { useNotification, Audio } from '@telnyx/react-client'; 3 4function Phone() { 5 const notification = useNotification(); 6 const activeCall = notification && notification.call; 7 8 return ( 9 <div> 10 {activeCall && 11 activeCall.state === 'ringing' && 12 'You have an incoming call.'} 13 14 <Audio stream={activeCall && activeCall.remoteStream} /> 15 </div> 16 ); 17}
useCallbacks1import { useCallbacks } from '@telnyx/react-client'; 2 3function Phone() { 4 useCallbacks({ 5 onReady: () => console.log('client ready'), 6 onError: () => console.log('client registration error'), 7 onSocketError: () => console.log('client socket error'), 8 onSocketClose: () => console.log('client disconnected'), 9 onNotification: (x) => console.log('received notification:', x), 10 }); 11 12 // ... 13}
useTelnyxRTCIf you need more fine-tuned control over TelnyxRTC, you also have access to useTelnyxRTC directly.
1import { useTelnyxRTC } from '@telnyx/react-client'; 2 3function Phone() { 4 const client = useTelnyxRTC({ login_token: 'mytoken' }); 5 6 client.on('telnyx.ready', () => { 7 console.log('client ready'); 8 }); 9 10 // ... 11}
Take care to use this hook only once in your application. For most cases, we recommend you use TelnyxRTCContext/TelnyxRTCProvider instead of this hook directly. This ensures that you only have one Telnyx client instance running at a time.
useContext with TelnyxRTCContextYou can retrieve the current TelnyxRTC context value by using React's useContext hook, as an alternative to TelnyxRTCContext.Consumer.
1import React, { useContext } from 'react'; 2import { TelnyxRTCContext } from '@telnyx/react-client'; 3 4function Phone() { 5 const client = useContext(TelnyxRTCContext); 6 7 client.on('telnyx.ready', () => { 8 console.log('client ready'); 9 }); 10 11 // ... 12}
TelnyxRTCContextProvider1import { TelnyxRTCProvider } from '@telnyx/react-client'; 2 3function App() { 4 const credential = { 5 // You can either use your On-Demand Credential token 6 // or your Telnyx SIP username and password 7 // login_token: 'mytoken', 8 login: 'myusername', 9 password: 'mypassword', 10 }; 11 12 const options = { 13 ringtoneFile: 'https://example.com/sounds/incoming_call.mp3', 14 ringbackFile: 'https://example.com/sounds/ringback_tone.mp3', 15 }; 16 17 return ( 18 <TelnyxRTCProvider credential={credential} options={options}> 19 <Phone /> 20 </TelnyxRTCProvider> 21 ); 22}
TelnyxRTCContext.Consumer1import { TelnyxRTCContext } from '@telnyx/react-client'; 2 3function PhoneWrapper() { 4 return ( 5 <TelnyxRTCContext.Consumer> 6 {(context) => <Phone client={context} />} 7 </TelnyxRTCContext.Consumer> 8 ); 9}
Audio1import { Audio } from '@telnyx/react-client'; 2 3function Phone({ activeCall }) { 4 return ( 5 <div> 6 <Audio stream={activeCall.remoteStream} /> 7 </div> 8 ); 9}
Video1import { Video } from '@telnyx/react-client'; 2 3function VideoConference({ activeCall }) { 4 return ( 5 <div> 6 <Video stream={activeCall.localStream} muted /> 7 <Video stream={activeCall.remoteStream} /> 8 </div> 9 ); 10}
Install dependencies:
1yarn install 2yarn start 3yarn link 4 5# in another tab: 6git clone https://github.com/team-telnyx/webrtc-examples/tree/main/react-client/react-app 7 8# fill in .env 9yarn install 10yarn link @telnyx/react-client 11yarn start

No vulnerabilities found.