<mcarter> disappearedng_, Instead of trying to understand how it all works, start by writing a very basic app and understand how the apis work. then try to get the big picture
<disappearedng_> mcarter: yeah I think I will give that a try
<disappearedng_> hold on I want to understand what orbited does first
<disappearedng_> let me try writing something in orbited
* lauanana has quit (Client Quit)
<mcarter> disappearedng_, orbited just gives you a socket
<mcarter> disappearedng_, there is no more explanation necessary than: Orbited lets you open a TCP socket from the browser.
<disappearedng_> ?
<disappearedng_> what do you mean
<disappearedng_> from the browser?
<disappearedng_> OH
<mcarter> disappearedng_, well, any browser
<disappearedng_> i thought it's something on the server side
<mcarter> disappearedng_, yes and no. there is a server-side component you have to run, but you don't ever really interact with it
<mcarter> disappearedng_, as far are you're concerned, you just do "new Orbited.TCPSocket()" in your browser, then write a raw tcp server for the back-end
<mcarter> disappearedng_, make sense?
<disappearedng_> hm yes in a way
<mcarter> disappearedng_, ok, don't you understand?
<disappearedng_> ok so as far as I know
<mcarter> no, sorry
<mcarter> I mis-typed
<mcarter> disappearedng_, I meant to say: "is there a particular part you don't understand"
<mcarter> heh, I'm not trying to be snarky, I'm actually trying to help
<disappearedng_> 1) why do you need a raw socket
<disappearedng_> actually why do you even need a socket
<disappearedng_> can't you just stick to port 80
<disappearedng_> like I really don't understand this
<mcarter> disappearedng_, lets step back for a second and forget the web entirely
<mcarter> disappearedng_, if you were writing a chat server and chat client, how would you do it?
<disappearedng_> so if I do a url.urlopen('http://www.myserver.com:8000?arg1=cat') I am essentially calling http://www.myserver.com on port 8000
<disappearedng_> ok if you don't mind listening to my naiveness
<disappearedng_> ORIGINALLY
<disappearedng_> i was thinking of writing a webservice
<mcarter> hold on, step back
<mcarter> forget the web for a second
<disappearedng_> ok
<mcarter> if you're just writing a desktop chat client, and a chat server, how would you approach it
<disappearedng_> so javascript on the browser keep calling server to see anything new
<mcarter> I can answer that for you if you'd like
<disappearedng_> so I will just keep calling the server to see if anything changed since last call
<mcarter> what you are describing is called polling
<disappearedng_> aka polling
<disappearedng_> yeah I just read that on wikipedia
<mcarter> There are actually a number of methods for doing that same thing, and some are better than others
<mcarter> long polling has significantly less latency than polling
<mcarter> and various types of streaming have less latency still
<disappearedng_> ok
<mcarter> Anyway, there are all these methods for checking with the server to see if there is new data
<mcarter> some of them work only in certain browsers
<disappearedng_> ok cool
<disappearedng_> I get what you mean now
<disappearedng_> so comet
<disappearedng_> is basiccally a bunch of techniques
<mcarter> yeah, exactly
<disappearedng_> used in JS or any other tools
<disappearedng_> that allows this PUSH technology
<mcarter> Its really crazy to try to implement these comet techniques yourself
<disappearedng_> yeah I just realized
<mcarter> I mean, they are really arcane in some cases, and have crazy behaviors
<mcarter> So naturally you go find a so-called Comet server in order to implement them
<disappearedng_> so wait
<disappearedng_> if comet is a bunch of techniques that allow you to do this
<disappearedng_> why is it a "server"
<disappearedng_> it should be more on the client side
<mcarter> well, you need both a server and a client
<disappearedng_> than the server side, no?
<mcarter> some of these techniques require very specific responses from the webserver
<disappearedng_> oh ok
<mcarter> there is actually a lot of work to get a webserver to spit out exactly the right response to make certain comet techniques work in a browser
<disappearedng_> so like the Early Java applets
<disappearedng_> where you actually need a TCP raw socket
<disappearedng_> ok much clearer now
<disappearedng_> so all I need to know
<disappearedng_> is that orbited gives you a raw socket on the browser
<mcarter> yes
<disappearedng_> and then I can just poll that socket until spits out
<mcarter> well, you don't have to poll anything, you can just attach an onread callback to the socket
<disappearedng_> well not poll, but something liek ( while socket == empty; ... )
<disappearedng_> oh ok
<disappearedng_> well even better
<disappearedng_> so an event listener a particular socket
<mcarter> yeah. your client side code will look something like this:
<mcarter> var sock = new Orbited.TCPSocket();
<mcarter> sock.onopen = function() { sock.send('HELLO!'); }
<disappearedng_> wait a minute
<disappearedng_> so if the client is NOT a browser
<mcarter> sock.onread = function(data) { alert("server said:" + data); }
<disappearedng_> then I don't have this problem?
<mcarter> sock.open('example.com, 2345)
<mcarter> well, if you are writing a desktop client then you have access to a socket already
<mcarter> the operating system provides that api for you
<disappearedng_> what about on mobile phone clients/
<disappearedng_> ah Is ee
<disappearedng_> ah I see
* ggdfsg (~ggdfsg@198.179.147.6) has joined #orbited
<ggdfsg> gfdsgds
<ggdfsg> nhgfj'
<disappearedng_> never the less I still need this for the web end
<mcarter> right
<mcarter> and even mobile phones don't have sockets in their browser
<disappearedng_> so let me ask you a question
<mcarter> sure
* ggdfsg has quit (Remote host closed the connection)
<disappearedng_> if on the browser I do a post to http://mysite.com:8000
<disappearedng_> this opens up a socket
<disappearedng_> like I am posting from port 80 of my site to port 8000 to mysite.com right?
<mcarter> sure
<disappearedng_> so it is still using the same socket as the original socket as to where I got the page from ?
<mcarter> disappearedng_, well, no, its on a different port, so it needs to open a new connection for the new http request
<disappearedng_> so new connection -> new socket
<disappearedng_> isn't that what we want to achieve ?
<mcarter> disappearedng_, you're asking about how the browser actually makes an HTTP Post to a different port, and yes, it uses a new socket
<mcarter> disappearedng_, but it doesn't give you access to that socket in order to send further data in either direction whenever you want... (i.e push)
<disappearedng_> then what makes comet so special
<disappearedng_> oh o ho ho
<disappearedng_> i get it now
<disappearedng_> oh ok
<disappearedng_> you see I had some misunderstanding
<mcarter> You should further understand something else,
<disappearedng_> yes please let me know
<mcarter> The way orbited provides a working socket for the browser is by tunneling all of the socket data over HTTP
<mcarter> for instance, when you do sock.open('example.com' 12345) in the browser, really it does an HTTP POST to orbited and say "hey, please open a socket on my behalf to example.com:12345"
<mcarter> orbited goes ahead and opens the socket for the browser
<mcarter> then when the remote destination sends data over the socket, orbited uses Comet techniques to push that data down to the browser, causing sock.onread to be invoked with that data
<mcarter> so you aren't really opening a direct socket to the end-point, and thats why you need the server-side component of Orbited
<mcarter> disappearedng_, so... where do we stand?
<disappearedng_> wow
<disappearedng_> man *you should put this in your doc*
<disappearedng_> i think I understand now
<disappearedng_> damn I just got enlightened
<mcarter> disappearedng_, stick the whole conversation in a doc? seems like a good idea...
<disappearedng_> yeah you should
<disappearedng_> I am posting this to my partner on this project
<disappearedng_> ok I need to do some sample apps on orbited to get started first
<disappearedng_> anything good to recommend? (fast and simple)
<mcarter> disappearedng_, well, the first question is: Do you know how to write a socket server?
<disappearedng_> using twisted yes
<disappearedng_> but I need to be refreshed
<mcarter> disappearedng_, I would say you should write an echo server, and test it out in telnet, then try connecting to it from the browser via orbited
<mcarter> disappearedng_, try eventlet: http://eventlet.net/doc/design_patterns.html#server-pattern
<mcarter> disappearedng_, that tiny code is a working echo server =)
<disappearedng_> ok let me give this a shot
<disappearedng_> thx very much for the explanation
<mcarter> disappearedng_, I put this conversation on the wiki: http://orbited.org/wiki/Conversation
<disappearedng_> you really should post this
<disappearedng_> this will instantly clear so much
<mcarter> disappearedng_, let me explain what else you'll need, because I very much need to sleep
<mcarter> disappearedng_, you'll need an orbited.cfg file similar to this: http://orbited.org/wiki/Configuration
<disappearedng_> ok
<disappearedng_> just dump here
<disappearedng_> I have to run home very quickly
<mcarter> disappearedng_, that has all sorts of stuff you don't really need, but the important part is the [access] section
<mcarter> disappearedng_, you need a line line "* -> localhost:4747"
<mcarter> disappearedng_, this basically says, allow any webpage to open socket connections via orbited to localhost:4747
<mcarter> disappearedng_, in that case, you'd run your echo server (or wahtever) on port 4747
<mcarter> disappearedng_, its worth noting that the hostname is *relative to Orbited*. So, if even if some remote visitor is running javascript code that does 'sock.open("localhost", 4747)', its not opening a socket on their local machine
<disappearedng_> ok cool
<disappearedng_> thx a lot for today
<mcarter> disappearedng_, rather, orbited is resolving localhost to the ip 127.0.0.1, and opening the socket to the same machine its running on
<disappearedng_> I haven't reach there yet but I will read up
<mcarter> disappearedng_, last thing you need to do is make an html page, and include Orbited.js with something like <script src="http://localhost:8000/Orbited.js"></script>
<mcarter> disappearedng_, on that page, you can open a socket using the TCPSocket api: http://orbited.org/wiki/TCPSocket
<mcarter> disappearedng_, thats about everything
<mcarter> disappearedng_, good luck
<mcarter> disappearedng_, let me know how it goes