REST methods

neogeo

Member
Hi,
i've done some work on REST methods based on this doc https://flashphoner.com/docs/wcs5/wcs_docs/html/en/wcs-rest-methods/
I successfully redirect all REST functions to my web app to achieve authentication for publishers/viewers. The whole app works like this:
1) When a user creates a session, i sent in "custom" parameters the application token and verify user on "connect" REST action
2) When a user publishes a stream i get a call to "PublishStream" REST action where the "published" value is true so i figure that this is the publisher
3) When a user try to view the stream i get a call to "PlayStream" REST action again but with the "published" value equal to false so i figure that this user is a viewer

Is my method right to identify subscribers/publishers?
Can i pass custom parameters on javascript createStream and see them to REST endpoint?

Regards
 
Last edited:

Max

Administrator
Staff member
Hello
1) When a user creates a session, i sent in "custom" parameters the application token and verify user on "connect" REST action
Looks correct.
As you can see Flashpnoner.createSession() has filed custom
https://flashphoner.com/docs/api/WCS5/client/web-sdk/latest/Flashphoner.html
So you can pass custom object as a parameter
Code:
custom: {
name: 'value'
}
2) When a user publishes a stream i get a call to "PublishStream" REST action where the "published" value is true so i figure that this is the publisher
If you handle /publishStream, this already means that stream is trying to be published by user. So here you don't need to check field published
3) When a user try to view the stream i get a call to "PlayStream" REST action again but with the "published" value equal to false so i figure that this user is a viewer
If you handle /playStream, this already means that stream is trying to play by user. So here you don't need to check field published again.
However if you handle event /StreamStatusEvent then you will be able to recognize if it is publisher or player checking published:true or published:false respectively.
Can i pass custom parameters on javascript createStream and see them to REST endpoint?
Yes you can pass the custom - object as a parameter for
Flashphoner.createSession()
https://flashphoner.com/docs/api/WCS5/client/web-sdk/latest/Flashphoner.html
session.createStream()
https://flashphoner.com/docs/api/WCS5/client/web-sdk/latest/Session.html
 
Top