You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
5. Import the RTConnect VideoCall component into your desired .jsx file.
91
88
92
-
6. Finally use the RTConnect VideoCall component as you would any other React component by passing in ‘ws://localhost:PORT’ as the URL prop as well as the optional mediaOptions prop
89
+
6. Finally use the RTConnect VideoCall component as you would any other React component by passing in `‘ws://localhost:PORT’` as the URL prop as well as the optional mediaOptions prop
93
90
94
-
- URL={ ‘ws://localhost:PORT’} (Note: the PORT whatever you specified when you set up your server)
(Note: If you are using an https server, then pass in ‘wss://localhost:PORT’ as the URL prop).
94
+
(Note: If you are using an https server, then pass in `‘wss://localhost:PORT’` as the URL prop).
98
95
96
+
**App.jsx:**
99
97
```
100
98
// App.jsx file
101
99
@@ -110,10 +108,93 @@ const App = () => {
110
108
/>
111
109
)
112
110
}
111
+
112
+
export default App;
113
+
```
114
+
115
+
## Setting Up Public Endpoint/URL Using a Secure Tunnel Service
116
+
In order to create a publicly accessible URL that will allow you to share access to your localhost server, you have a number of different options but a simple option is to use a secure tunnel service. One such free, secure tunnel service that you can use to create a secure, encrypted, publicly accessible endpoint/URL that other users can access over the Internet is ngrok.
117
+
118
+
ngrok Secure Tunnels operate by using a locally installed ngrok agent to establish a private connection to the ngrok service. Your localhost development server is mapped to an ngrok.io sub-domain, which a remote user can then access. Once the connection is established, you get a public endpoint that you or others can use to access your local port. When a user hits the public ngrok endpoint, the ngrok edge figures out where to route the request and forwards the request over an encrypted connection to the locally running ngrok agent.
119
+
120
+
Thus, you do not need to expose ports, set up forwarding, or make any other network changes. You can simply install [ngrok npm package](https://www.npmjs.com/package/ngrok) and run it.
121
+
122
+
### Instructions for Using ngrok With RTConnect
123
+
1. Sign up for a free ngrok account, verify your email address, and copy your authorization token.
124
+
125
+
2. Run the following command and replace with add your own authorization token:
126
+
```
127
+
config authtoken <your authorization token>
128
+
```
113
129
130
+
3. Install the ngrok npm package globally:
131
+
```
132
+
npm install ngrok -g
133
+
```
134
+
135
+
4. Start your app - make sure your server is running before you initiate the ngrok tunnel.
136
+
137
+
* The following is a a basic example of what your App.jsx and server.js files might look like at this point if you used `npx create-react-app`. If you're using a proxy server, then the default port when you run `npm start` is 3000 so set your server port to something else such as 8080.
138
+
139
+
**App.jsx:**
140
+
```
141
+
// App.jsx file
142
+
143
+
import React from 'react';
144
+
import VideoCall from 'rtconnect';
145
+
146
+
const App = () => {
147
+
return (
148
+
<VideoCall
149
+
URL={'ws://localhost:8080'}
150
+
mediaOptions={controls}
151
+
/>
152
+
)
153
+
}
154
+
114
155
export default App;
115
156
```
116
157
158
+
**server.js:**
159
+
```
160
+
// server.js
161
+
162
+
const path = require('path');
163
+
const express = require('express');
164
+
const bodyParser = require('body-parser');
165
+
const ngrok = require('ngrok');
166
+
const PORT = 8080;
167
+
const { SignalingChannel } = require('rtconnect'); // import the RTConnect Signaling Channel class
Louis Disen | [GitHub](https://github.com/LouisDisen) | [LinkedIn](https://www.linkedin.com/in/louis-disen/)
198
279
<br>
199
280
200
-
---
201
281
202
-
## <aname="support"/> ## A big shoutout to all of RTConnect's stargazers! Thank you!
203
-
[](https://github.com/oslabs-beta/RTConnect/stargazers)
282
+
## <aname="support"/>A big shoutout to all of RTConnect's stargazers! Thank you!
283
+
[](https://github.com/oslabs-beta/RTConnect/stargazers)
0 commit comments