Difference between revisions of "Client Server Model"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(XML)
(WebSockets Protocol)
Line 7: Line 7:
  
 
==WebSockets Protocol==
 
==WebSockets Protocol==
-Set of rules to create persistent connection between 2 devices <br>
+
A set of rules to create persistent connection between 2 devices:
-Enables real time collaboration <br>
+
*Client sends handshaking request to establish connection <br>
-Client sends handshaking request to establish connection <br>
+
*In response server creates full duplex connection on a single socket <br>
-In response server creates full duplex connection on a single socket <br>
+
*Data transferred both directions <br>
-Data transferred both directions <br>
+
*Either side can close the connection <br>
-Either side can close the connection <br>
+
 
-Message is the term given to packets of data sent using websockets <br>
+
[[File:Websockets.png]]
 +
 
 +
Message is the term given to packets of data sent using websockets, it creates a connection between the client and the server. The connection allows simultaneous exchange of data between the client and the server.
 +
 
 +
This is also routed via the HTTP port 80, so it will work in situations where other approaches or port numbers would be blocked by a firewall,
  
 
==CRUD==
 
==CRUD==

Revision as of 14:41, 21 May 2017

Response & Request

API

An API or Application Program Interface is a set of routines enabling one program to interface with each other. The code defines how the programs work together.

Twitter has an API to allow other programs to use the service.

WebSockets Protocol

A set of rules to create persistent connection between 2 devices:

  • Client sends handshaking request to establish connection
  • In response server creates full duplex connection on a single socket
  • Data transferred both directions
  • Either side can close the connection

Websockets.png

Message is the term given to packets of data sent using websockets, it creates a connection between the client and the server. The connection allows simultaneous exchange of data between the client and the server.

This is also routed via the HTTP port 80, so it will work in situations where other approaches or port numbers would be blocked by a firewall,

CRUD

Data must be stored, managed and represented correctly
CRUD is an acronym to explain the main processes required
-Create
-Retrieve
-Update
-Delete
All are needed to have a complete working database
SQL and Relational Databases conform to CRUD:
Insert , Select, Update, Delete

REST

JSON

XML

XML or Extensible Markup Language is a programming language used to define data types. The code uses tags represented as angled brackets <> and </> to signify the beginning and end of a segment of data of the type defined in the tags.

e.g.

<customers>
   <customer>
      <name> Daddy Wayne </name>
      <address> 420 Wilson Grove </address>
   </customer>
</customers>

This defines a parent data type <customers> containing one or more <customer> which contains <name> and <address>.

XML vs JSON

JSON XML
Human Readable It's easy to read because it's just defining objects and values. Less readable because it's contained within markup tags
Compact Code Less code than XML More code than JSON
Speed of Parsing Quicker, because it's defined as object and value Slower, because the data has to be extracted from tags
Ease of Creation Easier, because syntax is easier More like programming so more knowledge is needed.
Flexibility & Extendibilty Only works with limited data types, not enough for all applications Gives total freedom, because you can create what data types there are, so it has greater flexibility

REST Model