This is my first experiment with ruby. Don't be too shocked! - the title is misleading. ok.. let me explain.
I was trying out the interfacing of ruby with other languages like C/C++, Java etc and wanted an example. So, I downloaded the C API (libyahoo2) for yahoo messenger with the idea of writing a wrapper for it in ruby. But I somehow couldn't get it working even after trying for almost a week after which I was too frustrated and gave up that idea. In the process, I looked at the C source code and ...hey! I said. Why not...? yes! you guessed it right! It looked as though I could write it in ruby itself from scratch!
I started off soon. Now, Yahoo has its own packet strcture to manage communication between its client and server. Or, can you say its own Domain specific language in a very crude sense? whatever. I tried to build that packet structure but with no success. The yahoo server doesn't respond at all if the packet is not proper i.e. it doesn't say that I am wrong. This situation looked as though I was trying to communicate with an extra-terrestrial entity in its own language!
It was indeed a very tricky situation.
I was trying out the interfacing of ruby with other languages like C/C++, Java etc and wanted an example. So, I downloaded the C API (libyahoo2) for yahoo messenger with the idea of writing a wrapper for it in ruby. But I somehow couldn't get it working even after trying for almost a week after which I was too frustrated and gave up that idea. In the process, I looked at the C source code and ...hey! I said. Why not...? yes! you guessed it right! It looked as though I could write it in ruby itself from scratch!
I started off soon. Now, Yahoo has its own packet strcture to manage communication between its client and server. Or, can you say its own Domain specific language in a very crude sense? whatever. I tried to build that packet structure but with no success. The yahoo server doesn't respond at all if the packet is not proper i.e. it doesn't say that I am wrong. This situation looked as though I was trying to communicate with an extra-terrestrial entity in its own language!
It was indeed a very tricky situation.
- You don't have tests to tell you what to expect out of your code.
- You don't know how near you are or how far you are to the solution until you actually get the right solution.
But finally! after doing a little bit of trial and error and wishful thinking and all that, it actually talked to me! It started sending me the buddy lists, cookies and lots of things.
After that it was all normal. I generalised the packet generation and cleaned up my code. Right now I just have made of it a sort of API which can be used to write any sort of client. I have written a small CLI client with just the basic functionality of logging in and sending/receiving messages and typing notifications. Now I am thinking of writing a web-based client using ruby on rails and AJAX.
This was quite a useful experiment for me. It made me comfortable with ruby. I learnt a lot about how yahoo messenger works and in general how such asynchronous messaging works. I also recollected socket programming and multi-threaded programming and reading C code ;-).
After that it was all normal. I generalised the packet generation and cleaned up my code. Right now I just have made of it a sort of API which can be used to write any sort of client. I have written a small CLI client with just the basic functionality of logging in and sending/receiving messages and typing notifications. Now I am thinking of writing a web-based client using ruby on rails and AJAX.
This was quite a useful experiment for me. It made me comfortable with ruby. I learnt a lot about how yahoo messenger works and in general how such asynchronous messaging works. I also recollected socket programming and multi-threaded programming and reading C code ;-).
1 comment:
This passion to try out new things.. patience, creativity,....intelligence... I wish i had it too... :D
Post a Comment