Results 1 to 6 of 6

Thread: Notifying flash client of disconnect

  1. #1
    Join Date
    Jun 2012
    Posts
    4

    Default Notifying flash client of disconnect

    Clients are billed for the time they are connected to our service using a flash client, therefore our Wowza module keeps an eye on how much they have spent so far, in the case that they exceed their spending limit we want to disconnect the client from the live stream. However there we have an issue telling the client in a nice way they have been disconnected, here is what we have tried:

    1. Call client.rejectConnection which should raise the generic NET_STATUS event on the flash NetConnection object with the code "NetConnection.Connect.Rejected", this works fine in the onConnect handler on the module but after accepting the connection you can't seem to reject it later on.

    2. The other alternative is adding client side handler to do the closing, i seen this recommended by wowza support previously as being the solution but its unacceptable to leave this kind of access control to the client as this is easily circumvented, so this is not an option as the only solution.

    3. The last method we tried is to call a client side handler that notifies the user that he is disconnected and then straight after calling client.setShutdownClient(true) however doing this the client.call("NotifyOfDisconnect", null, "parameter") call seem to be ignored and the client is never notified. I assume we could solve this by using a delay on the setShutDownClient but that just seems wrong and will take up unnecessary resources.

    What is the recommendation in a case like this?

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    You can use sendClientOnStatusError to send notifications to Flash RTMP client's NetConnection. And you can use sendStreamOnStatusError to send notification to Flash RTMP client's NetStream.

    sendClientOnStatusError(client, code, description);
    		
    sendStreamOnStatusError(stream, code, description);
    You can send and code you want, but here is a reference of standard notifications:
    http://livedocs.adobe.com/flash/9.0/...atusEvent.html

    Richard

  3. #3
    Join Date
    Jun 2012
    Posts
    4

    Default

    Quote Originally Posted by rrlanham View Post
    You can use sendClientOnStatusError to send notifications to Flash RTMP client's NetConnection. And you can use sendStreamOnStatusError to send notification to Flash RTMP client's NetStream.

    sendClientOnStatusError(client, code, description);
    		
    sendStreamOnStatusError(stream, code, description);
    And can i use sendClientOnStatusError and immediately after use client.setShutDown(true) and the message will still arrive, i tested that earlier and it seemed the message newer got to the client before it is shutdown.

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Try adding a little delay.

    Richard

  5. #5
    Join Date
    Jun 2012
    Posts
    4

    Default

    Quote Originally Posted by rrlanham View Post
    Try adding a little delay.

    Richard
    From my first post: "I assume we could solve this by using a delay on the setShutDownClient but that just seems wrong and will take up unnecessary resources.", so basically there is no way to force a disconnect with a specific message from the serverside without doing it delayed?

  6. #6
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Your delay (#1) only involved setShutDownClient, I thought you wanted to get a message to the client first, that is all sendClientOnStatusError does. I don't think a little delay in this case is going to slow anything down, a few milliseconds should be enough.

    If you are the player developer, or can modify the source, you can listen for notification and have the client shutdown, as in your #2 option. Or the server-side delay. I don't know of another approach.

    Richard
    Last edited by rrlanham; 07-01-2012 at 02:40 PM.

Posting Permissions

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