REST methods

Discussion in 'Web Call Server 5' started by neogeo, Mar 27, 2017.

  1. neogeo

    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: Mar 27, 2017
  2. Max

    Max Administrator Staff Member

    Hello
    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'
    }
    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
    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.
    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
  3. neogeo

    neogeo Member

    Thank you for the clarification and suggestions, all work fine

Share This Page