|Adding Mode to server response.
||[Mar. 21st, 2003|08:24 pm]
LiveJournal Client Discussions
I am currently writing a client for LJ in ruby for the heck of learning and more experience of following specs. At the moment I am simply working on the inner core and forgetting about the user interface side of things.|
One thing that has come up from testing so far is that the server responses do not include the mode they are for. This would be very useful for determining what should parse the response and would prevent the need to possibly parse the response straight away.
My plan is have a request queue and a response queue and do it that when a response is get from the server it is passed to a method of the Request object (i.e LoginRequest) which will spit out a "proper" response object i.e. LoginResponse or GetFriendsResponse which will then be plopped into the queue to be dealt with at some point.
Does anyone else think a mode entry in the server response would be helpful?
It seems like of redundant, since you should know from the request you sent what response you're expecting. I can't envision any scenario, even if you're using a queue for your requests, that you shouldn't know what request caused each response; the HTTP protocol involves server responses directly to the requests you send and not asynchronous sending and receiving. Having the server identify which request it's responding would really just be a waste (albeit a tiny one) of bandwidth.
Good point wooble, somewhere along the way my brain started thinking about asynchronous comms.
2003-03-21 10:00 am (UTC)
more ruby clients
I'm intrested to see what you end up with as I have a ruby client myself, if you want to pull it apart its over here
but it has a fullish gtk UI enjoy
2003-03-21 10:17 am (UTC)
Re: more ruby clients
Thanks, I will have a look but more likely when I get further along. I want to try and not influence myself to much yet :)
I'll let you known when I finish, the core should be done over the weekend, maybe even a gui but probably not.
2003-04-25 05:51 am (UTC)
Re: more ruby clients
I made a new thread to continue this... check lj_clients if you're interested
2003-03-21 10:10 am (UTC)
Why not just check the head of the Request queue to get the type of response? If the protocol allowed responses to possibly come out of order this might be an issue, but it does.
If the protocol allowed responses to possibly come out of order this might be an issue, but it doesn't.
As I said to wooble, thanks somewhere along the way my brain started to think about async comms.
For the other bit, I will have my request object, which I could ask what mode it is for and pass the mode and the httpresponse object to a factory class which will return a "proper" response object that will be placed into the response queue for being dealt with later.