Skip to content

Commit

Permalink
Moved some classes from common to server to support WS lifecycle call…
Browse files Browse the repository at this point in the history
…backs
  • Loading branch information
mondain committed Oct 28, 2022
1 parent 5959816 commit 5d9560c
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 1 deletion.
15 changes: 15 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ Red5 Changelog

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

Version 1.3.7 (2022-10-28)
--------------------------
Moved from common to server:
ApplicationAdapter
MultiThreadedApplicationAdapter
StatefulScopeWrappingAdapter
PluginDescriptor
PluginLauncher
PluginRegistry
Red5Plugin

New interface IWebSocketAwareHandler for WebSocket aware connect/disconnect on implementations of MultiThreadedApplicationAdapter.



Red5 1.0.2 (2014-04-07)
-----------------------
Major release; improvements in threading, faster more efficient message handling, and fixes to a few memory leaks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,15 @@ public interface IWebSocketScopeListener {

void connectionRemoved(WebSocketScope wsScope, WebSocketConnection wsConn);

/**
* XXX(paul) maybe add this for recv update earlier than onMessage callback.
*
* String message received on the given connection and scope.
*
* @param wsScope
* @param wsConn
* @param message
*/
// void receivedMessage(WebSocketScope wsScope, WebSocketConnection wsConn, String message);

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.red5.io.IStreamableFile;
import org.red5.io.ITagReader;
import org.red5.logging.Red5LoggerFactory;
import org.red5.net.websocket.WebSocketConnection;
import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.api.Red5;
Expand Down Expand Up @@ -50,6 +51,7 @@
import org.red5.server.api.stream.IStreamService;
import org.red5.server.api.stream.IStreamableFileFactory;
import org.red5.server.api.stream.ISubscriberStream;
import org.red5.server.api.websocket.IWebSocketAwareHandler;
import org.red5.server.exception.ClientRejectedException;
import org.red5.server.jmx.mxbeans.ApplicationMXBean;
import org.red5.server.messaging.AbstractPipe;
Expand Down Expand Up @@ -99,7 +101,7 @@
* @author Paul Gregoire (mondain@gmail.com)
* @author Michael Klishin
*/
public class MultiThreadedApplicationAdapter extends StatefulScopeWrappingAdapter implements ISharedObjectService, IBroadcastStreamService, IOnDemandStreamService, ISubscriberStreamService, ISchedulingService, IStreamSecurityService, ISharedObjectSecurityService, IStreamAwareScopeHandler, ApplicationMXBean {
public class MultiThreadedApplicationAdapter extends StatefulScopeWrappingAdapter implements ISharedObjectService, IBroadcastStreamService, IOnDemandStreamService, ISubscriberStreamService, ISchedulingService, IStreamSecurityService, ISharedObjectSecurityService, IStreamAwareScopeHandler, IWebSocketAwareHandler, ApplicationMXBean {

/**
* Logger object
Expand Down Expand Up @@ -626,6 +628,12 @@ public boolean appConnect(IConnection conn, Object[] params) {
return true;
}

@Override
public boolean appConnect(WebSocketConnection wsConn, Object[] params) {
log.debug("appConnect: {}", wsConn);
return true;
}

/**
* Handler method. Called every time new client connects (that is, new IConnection object is created after call from a SWF movie) to the
* application.
Expand Down Expand Up @@ -669,6 +677,12 @@ public void appDisconnect(IConnection conn) {
}
}

@Override
public boolean appDisconnect(WebSocketConnection wsConn) {
log.debug("appDisconnect: {}", wsConn);
return true;
}

/**
* Handler method. Called every time client disconnects from the room.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.red5.server.api.websocket;

import org.red5.net.websocket.WebSocketConnection;

/**
* Interface for handlers that are aware of the WebSocketConnection.
*
* @author Paul Gregoire
*/
public interface IWebSocketAwareHandler {

/**
* Handler method. Called when a WebSocket connects to the application.
*
* @param conn
* WebSocket connection object
* @param params
* List of parameters after connection URL
* @return true upon success, false otherwise
*/
boolean appConnect(WebSocketConnection wsConn, Object[] params);

/**
* Handler method. Called when a WebSocket disconnects from the application.
*
* @param conn
* WebSocket connection object
* @return true upon success, false otherwise
*/
boolean appDisconnect(WebSocketConnection conn);

}

0 comments on commit 5d9560c

Please sign in to comment.