Homework required in preparation for this lecture
- Team homework - Server's schema
- Discuss and decide tables of data your game or product will require to be stored on the server.
- You should identify at least one and no more than 5 tables.
- And example might be: e.g. users (name, lastLogInDateTime), mood_record (UserId, happy_sad, gps) etc.
- Deliverable: A group blog post with your product's tables, their columns and data types
- XML Returned by a web service
- Imagine that you ask your server for information on one of the tables, for example, user == "pito salas"
- Write a little xml showing what the result of that request might look like
- Deliverable: An individual blog post with that write up. Make sure that all your proposed tables are covered by someone on the team.
- Read intro to Rails Guide
- There is a lot of information there beyond the step by step instructions
- You are reading this to get a general exposure to the concepts.
- You don't need to actually follow the step by step procedure
- understand the role of a server in a mobile app
- understand the end-to-end process of getting from a client to server and back
- concept of a database backed web site or server - html and xml
- general architecture of such a site
- tease a url apart and how surfing might work
- understand some of the tools used to build a site
- ruby on rails,
- Mysql and other SQL databases
- Operating System (e.g. Linux)
- From web sites to web services
Basics - Urls And Web Servers
- let's tease a url apart: http://www.salas.com/2003/05/31/no-i-dont-really-have/
- a server is a computer that is connected to the internet
- meaning it has an IP address and can receive requests
- a server 'talks' one or more protocols,
- e.g. TCP/IP, HTTP, DNS, UDP, etc., which means that when such a request comes to it, it knows what to do.
What is needed to 'create' a simple web server?
- design the html pages (which are just text files)
- connect a computer to 'the internet'
- make that computer act like a web server
- give it the html pages
- So far, all web pages are static. In real life, this is almost never the case
- Web pages are built-on the fly-by code
- So? http://www.salas.com/2003/05/31/no-i-dont-really-have/
// Method prototype
String get(String server, String protocol, String parameters...)
// Get html string
html_result = get("www.salas.com", "http", "2003/05/31/no-i-dont-really-have/");
- Can we think of the web server as more than something that we can surf to with a web browser?
- Discuss web page scraping and what is wrong with that
- What if the data were available as well, what would be possible?
- A Web server receives a URL and sends back HTML etc.
- A Web service receives a URL and sends back Data (XML etc.)
Looking at some examples
- Play with it using my apieky
- Maybe want to let user pick a city for giraffe adventure and show actual weather there?
- Maybe HappySad wants to try and correlate emotional status with the weather?
- Maybe you have a real estate app to help people decide where to live
- arXiv (http://arxiv.org/)
- Play with the API here: http://arxiv.org/help/api/index (click)
- Maybe you want to analyze research papers or study reference chains
- Amazon web service
- VoguableApp service
- One of the foundational protocols of the web (other ones are?)
- Request -> Response. Stateless.
- HTTP Protocol
- At the heart: a way to deliver 'URL' in to a 'Web Server' and tell it what to do with it and then process the result (TCP/IP not required!)
- URL -- URI?
- HTTP methods: GET, PUT, POST, DELETE... and others
- HTTP Request: Do <method> to this <url> resource.
- HTTP Response: <status> happened. Here's the result: <result>
- A protocol is a set of rules. Abstraction. Leaky Abstraction.
- Protocols determine the way information is interpreted 'on the wire'
- You can think of them as 'envelopes'
- Imagine I mail a big box of books to 'brandeis unversity, South Street, Waltham MA'
- Inside the box there are smaller boxes: 'computer science dept', 'math dept', etc.
- Each book is in an envelope: J. Smith, F. Johnson, etc.
- So with protocols are the first set of bits the 'higher' or 'lower' level protocol?
- transport control protocol, on TOP of IP
- handles delivery of those bits to and from a particular "application" to another "application"
- adds a 'port' number to IP
- the 'application' aka the 'server' and the other application aka the 'client'
- Teams work with clients
- Review homework for tomorrow's lecture.