Reputation: 1
I am confused about the current framework for a client/server architecture system.
You know, when we are writing a small demo, on the server side, we listen on a port and establish a TCP/UDP connection with client, after that, we do some customize work.
Well, my question is, when we are using a framework like Ruby on Rails, where can I put my customize work?
It seems these frameworks are just for people managing a website.
I can't add a comment, so some words more here.
Thanks for your answers. Actually, I know how to do socket programming to handle all the requrest. But since what I want to build is a product not a demo. I think a wide-used framework is what I need.
ACE and twisted seem good to do these things. But what about RoR? I saw many websites that you can use their APIs and get messages from their servers. Can't RoR do these things? If so, how can I implement HTTP + JSON communication between client and server without having a website page?
I checked several tutorials on RoR, they only told me how to build a website to present HTML files, but what I need is a mechanic to communicate between Server and Client.
Thank you.
Upvotes: 0
Views: 1297
Reputation: 1954
I assume you are looking for an explanation of where cusom code goes when the server is mostly built from reusable pieces coming from a framework.
Forgetting about Rails for now, many older, simpler frameworks started life as a simple way to build objects to represent the incoming request and the outgoing response on the server side. From there, your custom code would be in making decisions about what to do with the request, and what to write to the response.
A more complex framework may include a templating engine, which makes it easier to put a complete response together by filling in the blanks (like a user name) in an HTML template, avoiding the need to manually craft the whole HTML response in the server code.
A lot of modern frameworks allow you to write applications like this, and many provide other pieces of functionality to make common coding patterns quicker and easier to write.
Upvotes: 0
Reputation: 703
Not sure I understand exactly what you're asking but it seems like you're looking for the Ruby sockets framework?
http://www.tutorialspoint.com/ruby/ruby_socket_programming.htm
Is a pretty straightforward description of how to do basic port listening/reacting.
Upvotes: 0
Reputation: 82535
Ruby on Rails is indeed designed for implementing a website or other HTTP-related things.
There are other frameworks out there for doing more generic server implementations. For example: ACE and Twisted.
Upvotes: 2