Could somebody explain to me the architecture behind chatroulette?
I was thinking about a similar project that would only implement Audio
support (for starters). Is the best way to set this up a flash server?
If so, how should I go about getting into flash, will I need flex 4? I
have some beginner experience with c++, c# and java but I have never
developed anything for the web.
I was also wondering how the randomizer matches up the participants.
How would you code something like this.
Im obviously pretty clueless here and I'd greatly appreciate some advice
regarding this problem -- I don't expect copy and paste solutions. It
would just be nice to hear how you guys would tackle this problem.
Thank you very much
AFAIK ChatRoulette uses a new set of API's in Flash Player 10.1 codenamed Stratus, which allows for peer-to-peer connections between Flash Player instances.
So instead of the video and audio streams being pushed up to a special streaming server, like FMS or Red5 unique ID's are shared and peers connect directly to each other.
This has great possibilities to reduce server load for live streaming of events where 1 connection to a server stream can be shared between near neighbours.
Can you imagine the hosting bills for something like ChatRoulette if Stratus wasn't pushing the streams directly between the peers?!
If you're interested in knowing more check out Stratus' section on Adobe lads: http://labs.adobe.com/technologies/stratus/
How can you match up participants? easy. have a variable named "waiting users" which is initially set to null. When a user connects, if "waiting users" is null, make the connecting user the waiting user. If waiting users isn't null, create a new thread that manages those two user's conversation, and set waiting users to null. This "randomness" means that if you have many visitors, conversations should be random. However, if you only have 10 people doing conversations at a time, its not like you'll get amazing results. You need constant disconnects/connects for this to work.
With actionscript, you can easily get access to a microphone device via Microphone.get()
[use google to get more info]... You'll have to feed the data you receive to your server.
For the sake of not having to send HTTP headers nonstop, you should create a socket [actionscript supports this, look into flash.net.[Socket/Sockets? i forget]] and connect to a custom written server, which is easily done with c#... I haven't tried it with c++ and haven't worked with java...
The server will act as a "proxy" between your two clients...
It uses wowza's streaming server not Adobe's cirrus which you can't use in production due to license limitations.
http://www.streamingmedia.com/Articles/News/Featured-News/The-Tech-Behind-Chatroulette-66278.aspx