# Connect to other Wowza server using Java API

**URL:** <https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [November 10, 2010, 1:18pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701 "2010-11-10T13:18:54Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mick\_Sear](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Mick\_Sear](https://community.wowza.com/u/Mick_Sear)\
**Post date:** [November 10, 2010, 1:18pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/1 "2010-11-10T13:18:54Z")

</div>

I have a requirement to connect to a Wowza server from an HTTPProvider on another server, and pretend to be a Flash client so I can do an ISharedObject.send().

I can’t see any way in the API to do this. Am I missing it, or does that functionality just not exist?

I can do an ISharedObject.send() to locally connected clients, but if there are 2 servers, they may have different client connections.

---

<div class="post-metadata">

**Author:** ![Andrew\_Kennedy](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@Andrew\_Kennedy](https://community.wowza.com/u/Andrew_Kennedy)\
**Post date:** [November 10, 2010, 5:40am UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/2 "2010-11-10T05:40:43Z")

</div>

this should be possible. You would need to get the appInstance you want to work with, then get the sharedobject that appinstance, then you should be able to do the send for that object.

I can have at look at some code but it will not be until later today, if needed.

Shamrock

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [November 10, 2010, 2:13pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/3 "2010-11-10T14:13:03Z")

</div>

You can get other VHost like this:

```auto
IVHost vhost = VHostSingleton.getInstance("vhostName");

```

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [November 10, 2010, 4:44pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/4 "2010-11-10T16:44:55Z")

</div>

You can drill down from there:

```auto
IVHost vhost = VHostSingleton.getInstance("myVHost");
IApplication app = vhost.getApplication("vod");
IApplicationInstance appInstance = app.getAppInstance("_definst_");
ISharedObject so = appInstance.getSharedObjects().get("mySO");
so.send("clientsideCallback");

```

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [November 10, 2010, 6:24pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/5 "2010-11-10T18:24:34Z")

</div>

One Wowza server can use HTTPUtils API to load the HTTProvider from another Wowza server. This is all code that can run in a HTTProvider, which is a good way to communicate between Wowza servers, or any application that can load an HTTP url.

This post shows how to parse the querystring in HTTProvider, so you can pass in data. In your what VHost, App name, whatever you need to drill-down where you want to go and take the action you want.

[https://www.wowza.com/docs/how-to-parse-post-or-get-variables-in-an-http-provider](https://www.wowza.com/docs/how-to-parse-post-or-get-variables-in-an-http-provider)

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [March 22, 2011, 11:59pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/6 "2011-03-22T23:59:27Z")

</div>

No it isn’t.

Richard

---

<div class="post-metadata">

**Author:** ![Kevin\_Krieg](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@Kevin\_Krieg](https://community.wowza.com/u/Kevin_Krieg)\
**Post date:** [March 22, 2011, 5:57pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/7 "2011-03-22T17:57:49Z")

</div>

Sending commands using the HTTProvider is good but it would be nice to connect to the shared object directly…I take it this is not possible.

---

<div class="post-metadata">

**Author:** ![Mick\_Sear](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Mick\_Sear](https://community.wowza.com/u/Mick_Sear)\
**Post date:** [November 10, 2010, 2:00pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/8 "2010-11-10T14:00:07Z")

</div>

Yes, I think my issue is how to get the IApplicationInstance. I currently get it via :

```auto
IApplication app = vhost.getApplication(appName);
IApplicationInstance appInstance = app.getAppInstance(appInstanceName);

```

Where vhost is passed to my HTTPProvider’s ‘onHTTPRequest’ method. Then I can do:

```auto
ISharedObjects sharedObjects = appInstance.getSharedObjects(false);
ISharedObject so = sharedObjects.getOrCreate("aSharedObjectName");

```

There is apparently no method to get a handle on an IApplication running on another host.

---

<div class="post-metadata">

**Author:** ![Mick\_Sear](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Mick\_Sear](https://community.wowza.com/u/Mick_Sear)\
**Post date:** [November 10, 2010, 2:51pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/9 "2010-11-10T14:51:54Z")

</div>

Richard,

The Wowza server defines VHosts, yes, and I can always get a handle on another vHost _on the same server_. But what I want is to get a handle on an IApplicationInstance on _another server_. This will be in a different JVM, and will have it’s _own_ VHost.xml.

How can I do that? I’ve looked through the API, but I don’t see any kind of Wowza server connection class, that I can connect to as an IClient.

Imagine that these are 2 different servers (for load balancing reasons, to spread applications, or whatever). I have an HTTPProvider that tracks some server info and does an ISharedObject.send() to some SWF clients that might be using an ISharedObject on the other server. Please ignore security concerns with this for now - this is covered. I just need to know what I should be looking at in the API which will allow me to connect to a server as a conventional flash client would connect. If that’s not possible, that’s also a valid answer - but at the moment, I don’t know if it’s possible or not. I’m an experienced Java developer, but new to Wowza.

Thanks,

Mick

---

<div class="post-metadata">

**Author:** ![Mick\_Sear](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Mick\_Sear](https://community.wowza.com/u/Mick_Sear)\
**Post date:** [November 10, 2010, 5:54pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/10 "2010-11-10T17:54:03Z")

</div>

Yes, but this is all on the same server - the same installation of Wowza. My question (again) is how can I call another server?

I’m not a Flash developer, but from my understanding, a Flash client can connect to a server by ip address or some other URI, get a handle on a shared object, and do a SharedObject.send().

I just want to do this from Java, within an HTTPProvider.

---

<div class="post-metadata">

**Author:** ![m\_marmots](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@m\_marmots](https://community.wowza.com/u/m_marmots)\
**Post date:** [October 10, 2011, 1:33pm UTC](https://community.wowza.com/t/connect-to-other-wowza-server-using-java-api/35701/11 "2011-10-10T13:33:26Z")

</div>

I was trying exactly the same thing… in my opinion 3 options:

1.- HTTP -\> easiest but not elegant option

2.- WebService -\> could be

3.- java RMI -\> difficult to implement but really nice

what do you think ?
