# Play method serverside

**URL:** <https://community.wowza.com/t/play-method-serverside/46018>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [September 30, 2015, 3:38pm UTC](https://community.wowza.com/t/play-method-serverside/46018 "2015-09-30T15:38:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GAUTHIER\_DE\_GIRODON](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@GAUTHIER\_DE\_GIRODON](https://community.wowza.com/u/GAUTHIER_DE_GIRODON)\
**Post date:** [September 30, 2015, 3:38pm UTC](https://community.wowza.com/t/play-method-serverside/46018/1 "2015-09-30T15:38:54Z")

</div>

Hi, sorry my english is so bad, but i’ll try to explain my problem.

So, i should do a node js application who communicate with a wowza (engine 4.2) server to certified client and authorize play stream.

To communicate i use socket and a thread to parse command from node js.

client ==\> node js

client ==\> wowza server (play stream)

wowza server ==\> node js (call node js to authorize user to play stream)

node js ==\> wowza server (it’s ok you can play stream).

communication beetween node and wowza is ok. But i can’t play stream by serverside.

> ERROR server comment - invoke(play): java.lang.reflect.InvocationTargetException|at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)|at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)|at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)|at java.lang.reflect.Method.invoke(Unknown Source)|at com.wowza.wms.module.ModuleFunction.invoke(ModuleFunction.java:369)|
> 
> and now java code
> 
> PLAY from custom module
> 
> ```auto
> public void play(IClient client, RequestFunction function, AMFDataList params) {
> String id = client.getProperties().getPropertyStr("userID");
> String token = client.getProperties().getPropertyStr("token");
> int authorizedToPlay = client.getProperties().getPropertyInt("authorizedToPlay", 0);
> if(authorizedToPlay == 1){
> invokePrevious(this, client, function, params);
> }else{
> if(authorizedToPlay == -1){
> client.rejectConnection("not authorized");
> client.shutdownClient();
> }else{
> nodeJSCommunicator.requestPlayStream(id, token, client.getIp());
> }
> }
> }
> 
> ```
> 
> nodeJSCommunicator call to play
> 
> ```auto
> public void run() {
> while(running){
> try {
> message = in.readLine();
> JSONObject data = new JSONObject(message);
> if(data.getString("type").equals("disconnect")){
> this.server.disconnectUser(data.getString("userID"));
> }
> if(data.getString("type").equals("play_stream")){
> 					
> AMFDataList datalist = new AMFDataList();
> datalist.add(0, new AMFDataItem("play"));
> datalist.add(1, new AMFDataItem("0.0"));
> datalist.add(2, new AMFDataItem(""));
> datalist.add(3, new AMFDataItem("gauthier.f4v"));
> datalist.add(4, new AMFDataItem(0));
> datalist.add(5, new AMFDataItem(0));
> IClient client = this.server.getClient(data.getString("userID"));
> 					
> if(client != null){
> if(data.getString("status").equals("valid")){
> client.getProperties().setProperty("authorizedToPlay", 1);
> }else{
> client.getProperties().setProperty("authorizedToPlay", -1);
> }
> this.server.play(client, null, datalist);	
> }
> }
> 				
> } catch (IOException e) {
> running = false;
> }
> 			
> }
> }
> 
> ```
> 
> this.server refer to custommodule.
> 
> How can i do it?
> 
> Thx for watching 😉
> 
> PS: duplicate thread, i post first on bad forum can you delete older post from wowza 3 ?

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [October 19, 2015, 7:56am UTC](https://community.wowza.com/t/play-method-serverside/46018/2 "2015-10-19T07:56:24Z")

</div>

Hello

If you are looking to make a request to Wowza prior to initiating playback to determine if the given client is allowed, you might consider creating an [HTTP Provider](https://www.wowza.com/docs/http-providers) that can validate this for you. Then you can Client=\>Wowza Server (as you described above) via an http request that will return a pass/fail validation. Then use this return to determine whether you should init the playback or not.

Thanks,

Matt
