Results 1 to 8 of 8

Thread: Schedule a disconnect

  1. #1
    Join Date
    Feb 2016
    Posts
    4

    Default Schedule a disconnect

    Hello,

    I was wondering if the below code snipped is ok for disconnecting a client after a delay (in seconds). Reason I'm asking is because Wowza seems to be eating quite some memory and I'm not sure
    if it's leaking or not. Is it a leak when the client disconnects before the timeout gets called?

    /**
     * Play handler
     */
    public void play(IClient client, RequestFunction function, AMFDataList params) {
      //do checks
      this.remove(client, this.timeout);
    }
    
    public void remove(IClient client, int delay) {
      getLogger().info("[APP][REMOVE][SCHEDULE] " + client.toString());
      class Cleaner implements Runnable {
        IClient client;
    
        Cleaner(IClient c) {
          this.client = c;
        }
    
        public void run() {
          getLogger().info("[APP][REMOVE][EXECUTE] " + client.toString());
          client.setShutdownClient(true);
        }
      }
            
      ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
      executor.schedule(new Cleaner(client), delay, TimeUnit.SECONDS);
    }

  2. #2

    Default

    Please take a look at this module and see if it does what you are looking for:
    How to disconnect connected clients after a specified time period (ModuleTimedDisconnect)

    Regards,

    Salvadore

  3. #3
    Join Date
    Feb 2016
    Posts
    4

    Default

    Thank you but I kind of need a better grip on it, disconnect only certain clients and so. Can anyone show me a code snipped of how it should be done? I m more and more sure I'm leaking memory in my example.

    Regards,
    Radu

  4. #4

    Default

    Hello Radu,

    I believe that Salvadore's suggestion should be explored, because you could build your code of that existing module, to get the outcome you need for your workflow.

    How to disconnect connected clients after a specified time period (ModuleTimedDisconnect)


    You may also find that comparing the existing module to your code may give you insight on any adjustments that may be in order.

    If you still need assistance with your code and you have a Maintenance and Support contract you can submit a ticket for developer assistance here:
    https://www.wowza.com/support/open-ticket

    Regards,
    Jason Hatchett

  5. #5
    Join Date
    Feb 2016
    Posts
    4

    Default Timed Disconnect

    Quote Originally Posted by J.Hatchett View Post
    Hello Radu,

    I believe that Salvadore's suggestion should be explored, because you could build your code of that existing module, to get the outcome you need for your workflow.

    How to disconnect connected clients after a specified time period (ModuleTimedDisconnect)


    You may also find that comparing the existing module to your code may give you insight on any adjustments that may be in order.

    If you still need assistance with your code and you have a Maintenance and Support contract you can submit a ticket for developer assistance here:
    https://www.wowza.com/support/open-ticket

    Regards,
    Jason Hatchett
    Might sound like a stupid question but where can I find the source code of the module above?

    Regards,
    Samson Radu

  6. #6

    Default

    Hello Samson,

    You should be able to access the source code by downloading the full Addon Collection zip form this page:

    https://www.wowza.com/forums/content...ule-Collection

    Let me know if you do not find what you are looking for in that download.

    Regards,
    Jason Hatchett

  7. #7
    Join Date
    Feb 2016
    Posts
    4

    Default Timed Disconnect

    Great, found it thank you. I have also thought of looping through the currently connected clients and disconnect after making the checks. However I have one issue:

    Since the checks I perform (onPlay) are a bit expensive I'd like to be able to store some data on the IClient object to avoid checking again when the Timer runs. Is there a way of doing something like:

    public void play(IClient client, RequestFunction function, AMFDataList params) {
        //check permissions 
        client.set('PERMISSION_LEVEL', 2)
    }
    Then in the scheduled just look at the permission levels and disconnect some of the clients.

    Regards,
    Samson Radu

  8. #8
    Join Date
    May 2013
    Posts
    680

    Default

    Hello Samson

    It sounds like you might be looking to do something more like:
    public void play(IClient client, RequestFunction function, AMFDataList params) {
         /// ..if properly auth'd, set property
        client.getProperties().setProperty(“PERMISSION_LEVEL", 2);
    }
    And to later obtain the value:
    client.getProperties().getPropertyStr(“PERMISSION_LEVEL”);
    Thanks,
    Matt

Similar Threads

  1. Client disconnect on broadcaster disconnect
    By Kricken in forum Live Streaming and Encoders
    Replies: 1
    Last Post: 11-16-2014, 10:46 PM
  2. Replies: 3
    Last Post: 05-02-2014, 08:48 PM
  3. http flashplayer streaming disconnect not sending a disconnect to wowza
    By balajiswaroop in forum Media Players and Devices Discussion
    Replies: 1
    Last Post: 11-25-2013, 08:29 AM

Posting Permissions

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