Skip to content

Commit 67c5500

Browse files
committed
Minor logic update; doc updates
1 parent 0f3eafb commit 67c5500

File tree

5 files changed

+83
-36
lines changed

5 files changed

+83
-36
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "automatic"
3+
}

red5-server.code-workspace

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "."
5+
}
6+
],
7+
"settings": {
8+
"java.configuration.updateBuildConfiguration": "automatic"
9+
}
10+
}

rtmps.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
Error:
3+
Cannot support TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 with currently installed providers
4+
5+
Fix:
6+
Install the JSSE unlimited strength ciphers
7+
8+
Error:
9+
javax.net.ssl.SSLProtocolException: Handshake message sequence violation, 1
10+
11+
Fix:
12+
Turn off useClientMode on the rtmpsMinaIoHandler bean in red5-core.xml (off by default)
13+
14+
15+
http://ir5rtc.red5.org/demos/publisher.html
16+
rtmp://ir5rtc.red5.org/webrtc
17+
rtmps://ir5rtc.red5.org:8443/webrtc
18+
19+
20+
Unsupported extension status_request, data: 01:00:00:00:00
21+
Unsupported extension type_13172, data:
22+
Unsupported extension type_18, data:
23+
Unsupported extension type_16, data: 00:15:08:68:74:74:70:2f:31:2e:31:08:73:70:64:79:2f:33:2e:31:02:68:32
24+
Unsupported extension type_30032, data:
25+
26+
27+
http://www.sans.org/reading-room/whitepapers/authentication/ssl-tls-whats-hood-34297
28+
http://www.moserware.com/2009/06/first-few-milliseconds-of-https.html
29+
30+
http://stackoverflow.com/questions/26633349/disable-ssl-as-a-protocol-in-httpsurlconnection?rq=1
31+
http://stackoverflow.com/questions/28293068/java-7-ssl-changes-with-java-6
32+

server/README-TomcatPlugin.md

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The IP addresses and ports identified for `ws` and `wss` in the `conf/jee-contai
2121

2222
### Building for JDK8
2323

24-
Use this command to build for JDK8 since we are currently moving over to JDK11 builds: `mvn clean install -Djava.release.level=8 -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8`
24+
Use this command to build for JDK8 since we've moved to JDK11: `mvn clean install -Djava.release.level=8 -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8`
2525

2626
## Tomcat Server
2727

@@ -34,8 +34,6 @@ Websocket plug-in is integrated into the Tomcat plugin as of this latest release
3434

3535
This plugin is meant to provide websocket functionality for applications running in red5. The code is constructed to comply with [rfc6455](http://tools.ietf.org/html/rfc6455) and [JSR365](https://www.oracle.com/technetwork/articles/java/jsr356-1937161.html).
3636

37-
38-
3937
The previous Red5 WebSocket plugin was developed with assistence from Takahiko Toda and Dhruv Chopra.
4038

4139
## Configuration
@@ -128,31 +126,31 @@ Update the `conf/jee-container.xml` file to suit your needs.
128126
To bind to more than one IP address / port, add additional `httpConnector` or `httpsConnector` entries:
129127

130128
```xml
131-
<property name="connectors">
132-
<list>
133-
<bean name="httpConnector" class="org.red5.server.tomcat.TomcatConnector">
134-
<property name="protocol" value="org.apache.coyote.http11.Http11Nio2Protocol" />
135-
<property name="address" value="${http.host}:${http.port}" />
136-
<property name="redirectPort" value="${https.port}" />
137-
</bean>
138-
<bean name="httpConnector1" class="org.red5.server.tomcat.TomcatConnector">
139-
<property name="protocol" value="org.apache.coyote.http11.Http11Nio2Protocol" />
140-
<property name="address" value="192.168.1.1:5080" />
141-
<property name="redirectPort" value="${https.port}" />
142-
</bean>
143-
<bean name="httpConnector2" class="org.red5.server.tomcat.TomcatConnector">
144-
<property name="protocol" value="org.apache.coyote.http11.Http11Nio2Protocol" />
145-
<property name="address" value="10.10.10.1:5080" />
146-
<property name="redirectPort" value="${https.port}" />
147-
</bean>
148-
</list>
149-
</property>
129+
<property name="connectors">
130+
<list>
131+
<bean name="httpConnector" class="org.red5.server.tomcat.TomcatConnector">
132+
<property name="protocol" value="org.apache.coyote.http11.Http11Nio2Protocol" />
133+
<property name="address" value="${http.host}:${http.port}" />
134+
<property name="redirectPort" value="${https.port}" />
135+
</bean>
136+
<bean name="httpConnector1" class="org.red5.server.tomcat.TomcatConnector">
137+
<property name="protocol" value="org.apache.coyote.http11.Http11Nio2Protocol" />
138+
<property name="address" value="192.168.1.1:5080" />
139+
<property name="redirectPort" value="${https.port}" />
140+
</bean>
141+
<bean name="httpConnector2" class="org.red5.server.tomcat.TomcatConnector">
142+
<property name="protocol" value="org.apache.coyote.http11.Http11Nio2Protocol" />
143+
<property name="address" value="10.10.10.1:5080" />
144+
<property name="redirectPort" value="${https.port}" />
145+
</bean>
146+
</list>
147+
</property>
150148
```
149+
151150
*Note*
152151

153152
If you are not using unlimited strength JCE (ex. you are outside the USA), your cipher suite selections will fail if any containing `AES_256` are specified.
154153

155-
156154
Adding WebSocket to an Application
157155
------------------------
158156

@@ -162,13 +160,16 @@ To enable websocket support in your application, add this to your appStart() met
162160
WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin(WebSocketPlugin.NAME)).getManager(scope);
163161
manager.setApplication(this);
164162
```
163+
165164
For clean-up add this to appStop():
166165

167166
```
168167
WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin(WebSocketPlugin.NAME)).getManager(scope);
169168
manager.stop();
170169
```
170+
171171
Lastly, the websocket filter must be added to each web application that will act as a websocket end point. In the webapp descriptor `webapps/myapp/WEB-INF/web.xml` add this entry alongside any other filters or servlets.
172+
172173
```xml
173174
<!-- WebSocket filter -->
174175
<filter>
@@ -183,32 +184,36 @@ Lastly, the websocket filter must be added to each web application that will act
183184
<dispatcher>FORWARD</dispatcher>
184185
</filter-mapping>
185186
```
187+
186188
To support subprotocols, add them as a comma-delimited string in the `web.xml`:
189+
187190
```xml
188191
<!-- WebSocket subprotocols -->
189192
<context-param>
190193
<param-name>subProtocols</param-name>
191194
<param-value>chat,json</param-value>
192195
</context-param>
193196
```
194-
The plugin will default to allowing any requested subprotocol if none are specified.
195197

198+
The plugin will default to allowing any requested subprotocol if none are specified.
196199

197200
Extending the WebSocket Endpoint
198201
---------------------------
199202
Implementers may extend the default websocket endpoint class provided by this plugin `org.red5.net.websocket.server.DefaultWebSocketEndpoint`. The first step is to become familiar with the class and then `extend` it in your application; once that is complete, your class must be placed in the `lib` directory of your Red5 server, not the `webapps/yourapp/WEB-INF/lib` directory. Lastly, in your webapp descriptor `webapps/yourapp/WEB-INF/web.xml` file, an entry named `wsEndpointClass` will need to be made for your class:
203+
200204
```xml
201205
<context-param>
202206
<param-name>wsEndpointClass</param-name>
203207
<param-value>com.mydomain.websocket.MyWebSocketEndpoint</param-value>
204208
</context-param>
205209
```
206-
One reason to extend the endpoint for your own use is because the default endpoint implementation only handles text data.
207210

211+
One reason to extend the endpoint for your own use is because the default endpoint implementation only handles text data.
208212

209213
Security Features
210214
-------------------
211215
Since WebSockets don't implement Same Origin Policy (SOP) nor Cross-Origin Resource Sharing (CORS), we've implemented a means to restrict access via configuration using SOP / CORS logic. To configure the security features, edit your `conf/jee-container.xml` file and locate the bean displayed below:
216+
212217
```xml
213218
<bean id="tomcat.server" class="org.red5.server.tomcat.TomcatLoader" depends-on="context.loader" lazy-init="true">
214219
<property name="websocketEnabled" value="true" />
@@ -221,19 +226,19 @@ Since WebSockets don't implement Same Origin Policy (SOP) nor Cross-Origin Resou
221226
</array>
222227
</property>
223228
```
224-
Properties:
225-
* [sameOriginPolicy](https://www.w3.org/Security/wiki/Same_Origin_Policy) - Enables or disables SOP. The logic differs from standard web SOP by *NOT* enforcing protocol and port.
226-
* [crossOriginPolicy](https://www.w3.org/Security/wiki/CORS) - Enables or disables CORS. This option pairs with the `allowedOrigins` array.
227-
* allowedOrigins - The list or host names or fqdn which are to be permitted access. The default if none are specified is `*` which equates to any or all.
228-
229229

230+
Properties:
230231

232+
* [sameOriginPolicy](https://www.w3.org/Security/wiki/Same_Origin_Policy) - Enables or disables SOP. The logic differs from standard web SOP by *NOT* enforcing protocol and port.
233+
* [crossOriginPolicy](https://www.w3.org/Security/wiki/CORS) - Enables or disables CORS. This option pairs with the `allowedOrigins` array.
234+
* allowedOrigins - The list or host names or fqdn which are to be permitted access. The default if none are specified is `*` which equates to any or all.
235+
231236
Test Page
232237
-------------------
233238

234239
Replace the wsUri variable with your applications path.
235240

236-
```
241+
```xml
237242
<!DOCTYPE html>
238243
<meta charset="utf-8" />
239244
<title>WebSocket Test</title>
@@ -250,4 +255,3 @@ https://github.com/Red5/red5-websocket-chat
250255
Pre-compiled JAR
251256
----------------
252257
You can find [compiled artifacts via Maven](https://mvnrepository.com/artifact/org.red5/tomcatplugin)
253-

server/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,9 @@ public void removeListener(IWebSocketDataListener listener, String path) {
299299
*/
300300
public void makeScope(String path) {
301301
log.debug("makeScope: {}", path);
302-
WebSocketScope wsScope = null;
303302
if (!scopes.containsKey(path)) {
304303
// new websocket scope
305-
wsScope = new WebSocketScope();
304+
WebSocketScope wsScope = new WebSocketScope();
306305
wsScope.setPath(path);
307306
notifyListeners(WebSocketEvent.SCOPE_CREATED, wsScope, null);
308307
addWebSocketScope(wsScope);
@@ -320,12 +319,11 @@ public void makeScope(String path) {
320319
public void makeScope(IScope scope) {
321320
log.debug("makeScope: {}", scope);
322321
String path = scope.getContextPath();
323-
WebSocketScope wsScope = null;
324322
if (!scopes.containsKey(path)) {
325323
// add the name to the collection (no '/' prefix)
326324
activeRooms.add(scope.getName());
327325
// new websocket scope for the server scope
328-
wsScope = new WebSocketScope();
326+
WebSocketScope wsScope = new WebSocketScope();
329327
wsScope.setPath(path);
330328
wsScope.setScope(scope);
331329
notifyListeners(WebSocketEvent.SCOPE_CREATED, wsScope, null);

0 commit comments

Comments
 (0)