Wowza Community

Callbacks Client-Server interaction model


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

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


application.onConnect = function(client)
client.someServerMethod = function(someData)


var nc:NetConnection;
var nClient:Object;
nClient.someClientMethod = function():void
trace("some call from Server");
nc.client = nClient;"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:

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:


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.


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.


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 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…


	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: