Skip to content

Commit 5d9560c

Browse files
committed
Moved some classes from common to server to support WS lifecycle callbacks
1 parent 5959816 commit 5d9560c

File tree

10 files changed

+73
-1
lines changed

10 files changed

+73
-1
lines changed

changelog.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ Red5 Changelog
33

44
This file contains informations about the changes between the different versions of Red5.
55

6+
Version 1.3.7 (2022-10-28)
7+
--------------------------
8+
Moved from common to server:
9+
ApplicationAdapter
10+
MultiThreadedApplicationAdapter
11+
StatefulScopeWrappingAdapter
12+
PluginDescriptor
13+
PluginLauncher
14+
PluginRegistry
15+
Red5Plugin
16+
17+
New interface IWebSocketAwareHandler for WebSocket aware connect/disconnect on implementations of MultiThreadedApplicationAdapter.
18+
19+
20+
621
Red5 1.0.2 (2014-04-07)
722
-----------------------
823
Major release; improvements in threading, faster more efficient message handling, and fixes to a few memory leaks.

server/src/main/java/org/red5/net/websocket/listener/IWebSocketScopeListener.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,15 @@ public interface IWebSocketScopeListener {
2222

2323
void connectionRemoved(WebSocketScope wsScope, WebSocketConnection wsConn);
2424

25+
/**
26+
* XXX(paul) maybe add this for recv update earlier than onMessage callback.
27+
*
28+
* String message received on the given connection and scope.
29+
*
30+
* @param wsScope
31+
* @param wsConn
32+
* @param message
33+
*/
34+
// void receivedMessage(WebSocketScope wsScope, WebSocketConnection wsConn, String message);
35+
2536
}

common/src/main/java/org/red5/server/adapter/MultiThreadedApplicationAdapter.java renamed to server/src/main/java/org/red5/server/adapter/MultiThreadedApplicationAdapter.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.red5.io.IStreamableFile;
2222
import org.red5.io.ITagReader;
2323
import org.red5.logging.Red5LoggerFactory;
24+
import org.red5.net.websocket.WebSocketConnection;
2425
import org.red5.server.api.IClient;
2526
import org.red5.server.api.IConnection;
2627
import org.red5.server.api.Red5;
@@ -50,6 +51,7 @@
5051
import org.red5.server.api.stream.IStreamService;
5152
import org.red5.server.api.stream.IStreamableFileFactory;
5253
import org.red5.server.api.stream.ISubscriberStream;
54+
import org.red5.server.api.websocket.IWebSocketAwareHandler;
5355
import org.red5.server.exception.ClientRejectedException;
5456
import org.red5.server.jmx.mxbeans.ApplicationMXBean;
5557
import org.red5.server.messaging.AbstractPipe;
@@ -99,7 +101,7 @@
99101
* @author Paul Gregoire ([email protected])
100102
* @author Michael Klishin
101103
*/
102-
public class MultiThreadedApplicationAdapter extends StatefulScopeWrappingAdapter implements ISharedObjectService, IBroadcastStreamService, IOnDemandStreamService, ISubscriberStreamService, ISchedulingService, IStreamSecurityService, ISharedObjectSecurityService, IStreamAwareScopeHandler, ApplicationMXBean {
104+
public class MultiThreadedApplicationAdapter extends StatefulScopeWrappingAdapter implements ISharedObjectService, IBroadcastStreamService, IOnDemandStreamService, ISubscriberStreamService, ISchedulingService, IStreamSecurityService, ISharedObjectSecurityService, IStreamAwareScopeHandler, IWebSocketAwareHandler, ApplicationMXBean {
103105

104106
/**
105107
* Logger object
@@ -626,6 +628,12 @@ public boolean appConnect(IConnection conn, Object[] params) {
626628
return true;
627629
}
628630

631+
@Override
632+
public boolean appConnect(WebSocketConnection wsConn, Object[] params) {
633+
log.debug("appConnect: {}", wsConn);
634+
return true;
635+
}
636+
629637
/**
630638
* Handler method. Called every time new client connects (that is, new IConnection object is created after call from a SWF movie) to the
631639
* application.
@@ -669,6 +677,12 @@ public void appDisconnect(IConnection conn) {
669677
}
670678
}
671679

680+
@Override
681+
public boolean appDisconnect(WebSocketConnection wsConn) {
682+
log.debug("appDisconnect: {}", wsConn);
683+
return true;
684+
}
685+
672686
/**
673687
* Handler method. Called every time client disconnects from the room.
674688
*
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.red5.server.api.websocket;
2+
3+
import org.red5.net.websocket.WebSocketConnection;
4+
5+
/**
6+
* Interface for handlers that are aware of the WebSocketConnection.
7+
*
8+
* @author Paul Gregoire
9+
*/
10+
public interface IWebSocketAwareHandler {
11+
12+
/**
13+
* Handler method. Called when a WebSocket connects to the application.
14+
*
15+
* @param conn
16+
* WebSocket connection object
17+
* @param params
18+
* List of parameters after connection URL
19+
* @return true upon success, false otherwise
20+
*/
21+
boolean appConnect(WebSocketConnection wsConn, Object[] params);
22+
23+
/**
24+
* Handler method. Called when a WebSocket disconnects from the application.
25+
*
26+
* @param conn
27+
* WebSocket connection object
28+
* @return true upon success, false otherwise
29+
*/
30+
boolean appDisconnect(WebSocketConnection conn);
31+
32+
}

0 commit comments

Comments
 (0)