# Remote server module method calling from javascript

**URL:** https://community.wowza.com/t/remote-server-module-method-calling-from-javascript/42852
**Category:** Wowza Streaming Engine
**Created:** [November 20, 2015, 9:10am UTC](https://community.wowza.com/t/remote-server-module-method-calling-from-javascript/42852 "2015-11-20T09:10:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Roman\_Panov](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Roman\_Panov](https://community.wowza.com/u/Roman_Panov)
#### Post date: [November 20, 2015, 9:10am UTC](https://community.wowza.com/t/remote-server-module-method-calling-from-javascript/42852/1 "2015-11-20T09:10:28Z")

</div>

Hello and good time of day.

Got it (remote server module method calling) to work with flash.

But is this possible to work with RMI from JavaScript (and HTML5 players).

Thanks in advance.

---

<div class="post-metadata">

### Author: ![Michelle\_B](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/michelle_b/32/394_2.png) [@Michelle\_B](https://community.wowza.com/u/Michelle_B)
#### Post date: [November 20, 2015, 4:39pm UTC](https://community.wowza.com/t/remote-server-module-method-calling-from-javascript/42852/2 "2015-11-20T16:39:52Z")

</div>

Hi Eliont,

Can you provide more details on your user requirements? Some remote calls may be possible by executing [REST API calls](https://www.wowza.com/docs/wowza-streaming-engine-rest-api-query-examples-curl), which can be done from JavaScript as a simple HTTP request.

Michelle

---

<div class="post-metadata">

### Author: ![Roman\_Panov](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Roman\_Panov](https://community.wowza.com/u/Roman_Panov)
#### Post date: [November 21, 2015, 10:39am UTC](https://community.wowza.com/t/remote-server-module-method-calling-from-javascript/42852/3 "2015-11-21T10:39:04Z")

</div>

Thanks, i check it.

What is done:

Client:

```auto
			private function send_metadata():void {
				
				var JSONMetadata:Object = new Object();
				
				JSONMetadata.txt = 'Metadata';
				
				NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
				
				var nc:NetConnection = new NetConnection();   
				nc.connect("rtmp://localhost:1935/live");
				nc.call("injectEvent", null, "video", JSONMetadata);
			}

```

Wowza:

```auto
	public void injectEvent(IClient client, RequestFunction function,
			AMFDataList params) {
		String streamname = params.getString(PARAM1);
		AMFDataObj question = params.getObject(PARAM2);
	
		IMediaStream stream = client.getAppInstance().getStreams()
			.getStream(streamname);
		if(stream != null) {
			getLogger().info("event injected into " + streamname);
			stream.sendDirect("question", question);
		} else
			getLogger().info("stream " + streamname + " wasn't found to inject into");
	}

```

Client:

```auto
                vid.attachNetStream(ns);
                //Handle onMetaData and onCuePoint event callbacks: solution at http://tinyurl.com/mkadas
                //See another solution at http://www.adobe.com/devnet/flash/quickstart/metadata_cue_points/
                var infoClient:Object = new Object();
                infoClient.onMetaData = function oMD():void { };
                infoClient.onCuePoint = function oCP():void { };   
				
                infoClient.question = function question(data:Object):void
				{
					Alert.show(data.txt);
				};   
				
                ns.client = infoClient; 

```

What is needed: do something alike with HTML5 player.

---

<div class="post-metadata">

### Author: ![Roman\_Panov](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Roman\_Panov](https://community.wowza.com/u/Roman_Panov)
#### Post date: [November 23, 2015, 12:26pm UTC](https://community.wowza.com/t/remote-server-module-method-calling-from-javascript/42852/4 "2015-11-23T12:26:04Z")

</div>

> What is needed: do something alike with HTML5 player.

Any suggestions?
