Results 1 to 8 of 8

Thread: Writing/Reading Session Key and value to Wowza Client Session

  1. #1

    Default Writing/Reading Session Key and value to Wowza Client Session

    I have written a module that needs to write a Key (with value) to the Wowza Client Session that is created on user playing a stream.

    I can see sessions being created and destroyed after a time period, so it would be useful to use that session to hold the extra data rather that using DB tables.

    Please can anyone advise an easy way of writing/reading through the Wowza IDE to those sessions?

    Thanks
    Dominic

  2. #2
    Join Date
    Dec 2007
    Posts
    25,882

    Default

    The session is created onConnect. Take a look at these posts.

    http://wowzamedia.com/forums/showthread.php?p=41892#4

    http://96.30.11.104/forums/showthread.php?t=6205#3

    Richard

  3. #3

    Default

    You can catch session creates/destroys using the onRTPSessionCreate event handler. You can attach data to the session using the rtpSession.getProperties() container.

    Charlie

  4. #4

    Default

    Ok cool I can see the session details in my class that extends ModuleBase.

    I have another class that implements IMediaStreamActionNotify2, can I set properties in the the ModuleBase/root session from this class?
    Last edited by DominicFallows; 05-24-2010 at 08:48 AM.

  5. #5
    Join Date
    Dec 2007
    Posts
    25,882

    Default

    IMediaStreamActionNotify2 event handlers run when streams are published and when Flash clients subscribe.

    You can store properties in any Wowza object in any of these event handlers.

    You might want to use ApplicationInstance properties container, so you can set in onConnect or IMediaStreamActionNotify2 onPublish and read in onRTPSessionCreate, for example.

    Richard

  6. #6

    Default

    Hey, thanks for your reply...

    That works for setting OnConnect data, however I also need to set data on a timer within the IMediaStreamActionNotify2 onPause().

    Outline of what i'm trying to do (in case i've gotten myself confused its the first hot day here in UK for a long time!)

    1. Application Start - sets globals (such as database details etc)
    2. Client Connect (ModuleBase) - starts a session (Session A)
    3. Client Plays Stream (IMediaStreamActionNotify2) - timer pulses an updated value to Session A. A second session (Session B) seems to be created at stream level.
    4. Client Plays another stream (IMediaStreamActionNotify2) - Session C created (stream level), Session B destroyed (old stream), Session A is retained as their root session hasn't disconnected. Timer pulses an updated value to Session A.
    5. Client Session A is destroyed after an Idle/disconnected period.

  7. #7
    Join Date
    Dec 2007
    Posts
    25,882

    Default

    This is why I suggest setting properties in ApplicationInstance, which is can be reached from any of these points.

    Code:
    IApplicationInstance appInstance = client.getAppInstance();
    IApplicationInstance appInstance = stream.getClient().getAppInstance();
    IApplicationInstance appInstance = httpSession.getAppInstance();
    
    WMSProperties prop = appInstance.getProperties();
    prop.setProperty("example", "value");
    String example = prop.getProperty("example");
    Richard

  8. #8

    Default

    Thank you very much

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •