[Red5] UUIDs in ActionScript

Art Clarke aclarke at vlideshow.com
Tue Nov 13 17:21:57 PST 2007


Thanks everyone -- a lot of great suggestions.  It does appear there is a
Flex version that would meet my needs, but I'm not using Flex, and don't
want to import those libraries.

Also, although I'd love to have version-1 UUIDs (those are the UUIDs that
are guaranteed to be unique in time and space based on things like MAC
addresseses), it's a nice to have right now.

So I went ahead and implemented a very basic UUID class for ActionScript
3.0.  It's version 4, and only as good as Flash's Math.random() function,
but it works well enough for my message-ids.

If anyone is interested, feel free to use.  It's under the MIT License:
http://www.vlideshow.com/opensourcedcode

In future versions I may implement some way to seed with a unique
space-seed, so some of the call-back mechanisms people brought up could be
made to work.  We'll see.

- Art

-----Original Message-----
From: red5-bounces at osflash.org [mailto:red5-bounces at osflash.org] On Behalf
Of Thijs Triemstra | Collab
Sent: Tuesday, November 13, 2007 5:06 PM
To: red5 at osflash.org
Subject: Re: [Red5] UUIDs in ActionScript

Flex has the UIDUtil class: http://livedocs.adobe.com/flex/2/langref/ 
mx/utils/UIDUtil.html

Thijs


On Nov 13, 2007, at 10:47 PM, Walter Tak wrote:

>> I know this isn't specifically Red5 related but I need this for  
>> the Red5
>> app I'm building.  I'm writing a flash application and  
>> corresponding Red5
>> java app that pass events back
>> and forth to each other (using ActionScript NetConnection.call and  
>> Red5
>> IServiceCall stuff.  I'd like to pass a Unique Identifier back and  
>> forth
>> for each event to aid in debugging.
>> In prior systems I've gotten used to using RFC 4122 UUIDs (the  
>> stuff that
>> Java and MSFT use for this).
>
>
>> Generating a version 4 UUID in Red5 is trivial (java.util.UUID),  
>> but there
>> doesn't seem to be a correspondingly easy way to generate RFC- 
>> compliant
>> UUIDs in flash, and I want
>> the event originator (which is Flash) to set the UUID.  Does  
>> anyone know of
>> a library or code out there that does this in ActionScript (if  
>> not, I'm
>> happy to share whatever I end
>> up creating)?
>
>> Thanks in advance,
>
> Can't you have your Flash client initiate a connect to your Red5  
> server and
> then have the Red5 server generate a UUID for the client ?
>
> In fact I often have our server generate some sort of UID for an  
> unknown/new
> client, then let the client store the UID in it's local shared  
> object (aka
> flash cookie) so we know who is connecting the next time the client  
> connects
> (and then passes his UID from his local shared object as an  
> identifier).
>
> Walter
>
>
> -- 
> I am using the free version of SPAMfighter for private users.
> It has removed 13730 spam emails to date.
> Paying users do not have this message in their emails.
> Get the free SPAMfighter here: http://www.spamfighter.com/len
>
>
>
> _______________________________________________
> Red5 mailing list
> Red5 at osflash.org
> http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org




More information about the Red5 mailing list