Unable to invoke client methods from serverside
Red5 / Red5pro provides a mechanism to invoke client side methods from server code using the IServiceCapableConnection interface.
Example Red5 / Red5pro Server side Snippet :
private void serverToClient(IConnection conn, String method){
try{
IServiceCapableConnection invokeConn = (IServiceCapableConnection) conn;
invokeConn.invoke(method);
}catch(Exception e){
log.error("An error occurred {}", e.getMessage());
}
}
OR
private void serverToClient2(IConnection conn, String method, Object[] args){
try{
IServiceCapableConnection invokeConn = (IServiceCapableConnection) conn;
invokeConn.invoke(method, args);
}catch(Exception e){
log.error("An error occurred {}", e.getMessage());
}
}
This works as expected on an RTMP client (Flash) but when trying to use it with Red5pro Android SDK, I am running into an error even though the message is right there in that class.:
Error Details
/r5pro: Received invoke: clientMethod1 - void with 0 params
D/R5Stream: Received callback from JNI - clientMethod1 |
D/R5Stream: Failed to call method with error: clientMethod1 [class java.lang.String
Client TestSource Code:
https://github.com/rajdeeprath/streaming-android/blob/feature/connection-messaging/app/src/main/java/red5pro/org/testandroidproject/tests/PublishServerMessagingTest/PublishServerMessagingTest.java
Flash Client TestSource Code:
https://github.com/rajdeeprath/red5-development-series/blob/master/code-examples/client-side/connection-messaging-demo/src/Main.mxml
Red5Pro server side Code:
https://github.com/rajdeeprath/red5-development-series/tree/master/code-examples/server-side/red5-connection-examples/connection-messaging-demo
The application should be built using maven and deployed on Red5pro server before you run the client test from the project.