Callbacks Client-Server interaction model

Hello!

I want to build my application with callback interaction. What is it?

For example, when I work with FMS, I use this code:

Server

application.onConnect = function(client)
{
application.accetConnection(client);
client.someServerMethod = function(someData)
{
this.call("someClientMethod");
}
}

Client

var nc:NetConnection;
var nClient:Object;
nClient.someClientMethod = function():void
{
trace("some call from Server");
}
nc.client = nClient;
nc.call("someServerMethod",null, someData);

When client called someServerMethod, server call someClientMethod. I need to do this scheme in Wowza Server.

I don`t want to use Responders on client side

Now I write in my Wowza application next code:

public void someServerMethod(IClient client, RequestFunction function,
			AMFDataList params) 
	{
		getLogger().info("someServerMethod called");
		
	}

And when client call someServerMethod, I see in console: WARN server comment - Missing function: someServerMethod

Before in method onConnect i do client.acceptConnection();

And I do not know how to call any method on the client…

Can you talk me about callbacks?

Here’s one example:

https://www.wowza.com/forums/showthread.php?10629-LiveStreamRecord-Module-for-recording-a-live-stream-on-demand/page12#113

Take a look at the ServerSideModules example that ships with Wowza. There is a Flash client. It is a working reference of Flash <> Wowza methods.

There are other examples here:

https://www.wowza.com/docs/

Richard

If you have an Application module with onAppStart handler you should see the log output when the application starts, not when Wowza starts if that is when you were looking. Run Wowza in stand-alone mode for testing and dev (/bin/startup.bat) so you can see what is happening (stop the service first if it is running). To start the app, play (if vod) or publish (if live app) a stream for it to load and run onAppStart handler.

Richard

Also, at least as I understand the terminology, a function like onAppStart is an event handler. A callback in Wowza/Flash app is a function in one (or the other) that is called by the other, and might return data to the caller. Wowza can call Flash callback functions, and Flash can call Wowza callback functions.

Richard

With all respect, this is an incorrect example.

I want to do my system without Responders - only callbacks. Responders not provide asynchrony interaction model. They can realize only call-response model.

In BWChecker example I find sample - client do nc.call without responder, but I can`t repeat it…

Problem - Wowza dont know about my someServerMethod. And server dont trace any messages, which writed in methods onConnect, onAppStart and any…

Sample

	public void onAppStart(IApplicationInstance appInstance) {
		String fullname = appInstance.getApplication().getName() + "/"
				+ appInstance.getName();
		getLogger().info("onAppStart: " + fullname);
	}

If I right understand - Wowza IDE must trace in console “onAppStart: HelloWorld”. But no this message and other messages too.

But thank you for second link - must read for me :slight_smile: