Enterprise Ajax in PHP - PowerPoint PPT Presentation

1 / 40
About This Presentation
Title:

Enterprise Ajax in PHP

Description:

Tech Lead of Yahoo! Groups. 6/20/09. Enterprise AJAX in PHP. 3. Things ... oReq = YAHOO.Groups.util.Ajax(sUrl,oCinfig); oReq.setExpire(10); oReq.get(); 6/20/09 ... – PowerPoint PPT presentation

Number of Views:77
Avg rating:3.0/5.0
Slides: 41
Provided by: yah69
Category:
Tags: php | ajax | enterprise | groups | yahoo

less

Transcript and Presenter's Notes

Title: Enterprise Ajax in PHP


1
Enterprise Ajax in PHP
  • Presented ByHedger Wang ??

2
Front-end Engineer?????
Tech Lead of Yahoo! Groups
3
? Things to ask About Enterprise AJAX?? AJAX
????????
4
?JS??PHP Let JS call PHP
5
???PHP??JavaSCriptNot PHP in JavaScript
  • // here we are between the server and output,
    known as client
  • hello ucwords('hello php world')
  • // imagine that we would like to use a
    variable
  • // defined somewhere in the server
  • global something

http//webreflection.blogspot.com/2008/04/script-t
ype-php.html
6
???Web ServiceAnd Not Web Service
UDDI
Service Broker
WSDL
WSDL
f(x)
SOAP
Service Requester
Service Provider
7
?? ITS REFLECTION
8
??JavaScript???PHP ???! Lets Call PHP Function
from JavaScript
str ?
function helloWorld() var onlLoad
function(str) //do something var
onError function(str) //do something
callPHPFunction(helloWorld, onlLoad, onError ,
Hedger)
9
Reflection Diagram
JavaScriptfn( x )
JSON
PHP5class Handler
public fn( x )
JSON
10
Example??
  • Invalid Call????
  • Parameters????
  • Error Handling????

11
JSON ?? / JSON ??JSON Response JSON Request
JSON Request
JSON Response
"id""ajax_request_1", "requests"
"action""whoAmI", "params" "Hedger
Wang", 30, "Chinese","Thai","Korean","Japa
nese", "email""hedgerwang_at_gmail.com",
"web site""http//www.hedgerwow.com"

"id""ajax_request_1","results""action""whoAm
I","data""My name is Hedger Wang and I am 30
years old. My fav foods are Chinese food, Thai
food, Korean food, Japanese food, . My
Contact info is email hedgerwang_at_gmail.com
web site http\/\/www.hedgerwow.com "
12
??BATCHING
13
Persistent http connections diagram
PHP Server
?????,????????????network.http.max-connections-pe
r-server 2
JavaScript Client
14
Firebug These Request Compete the same
connection resources
JS
CSS
IMG
AJAX
15
Example??
  • Batching ??
  • Dependency ??
  • Binding??

16
Pseudo Codes Snippets forDecoupled Logics
Binding Dependent Batching Request
function getContactName(i) var o1
actiongetPhoneNumber,params2 var o2
actioncallSomeone,dependent1,bind1
var o3 actionaskName,dependent1,bi
nd1 Request.post( or1,or2,or3) function
getContactNumber(i) var o1
actiongetPhoneNumber,params2
  • index ) number this-numbersindex
  • public callSomeOne(number) person
    this-dial(number) return person
    public askName(person) return
    personname
  • ?

17
Load Render Content
ServiceLogic
Data
Views Template
PHP Controller
JSON
HTML
DOM
HTML
JavaScript
18
Example??
  • HTML Include HTML???
  • AJAX Include AJAX???

19
?? QUEUE MANAGEMENT
20
Queue Manager
  • Many Developers
  • Many Codes
  • Many Languages
  • Many Requests
  • Many Datas
  • And many to many

21
We have requests from everywhere??????????









22
???? ? ???? Defensive management or Optimistic
Anarchism
Server
Http Connections Management
Http Connections Queue Management
JavaScript Queue Management
Client
23
??SYNCHRONIZED
24
?????Baking A Duck
  • Class Cook
  • public function addFire()
  • //wait to raise fire sleep(10)
    systemsetFire(true) return true
  • public function bakeDuck()
  • if(systemgetFire())return systembakeDuck
    throw new Exception(no fire)
  • ?
  • var Cook
  • addFirefunction()
  • //call PHP addFire
  • bakeDuckfunction()
  • //call PHP bakeDuck
  • onclickCook.addFire()
  • onclickCook.backDuck()

Add Fire
Bake Duck
25
??????
Aynchronized Connection Model
????First In First Out
????Last In First Out
????One In One Out
26
Example??
  • ??Asynchronized
  • ??Synchronized

27
?REDUNDANCY
28
?????Redundant Requests
getRSSFeedFromUrl( http//new.yahoo.com/rss/1
)
29
??????? Remove Redundant Requests
30
Example??
  • Without Redundancy Management
  • With Redundancy Management

31
??CACHE
32
????????Server Side Request Cache Model
  • Request URL ? Connect ? Expired ? Download
  • Request URL ? Connect ? Not Expired ? Cache

Its Cached, maybe.
33
???????Client Side Request Cache Model
  • Request URL ? Expired ? Connect ? Download
  • Request URL ? Not Expired ? Cache

Its Cache on Demand
oReq YAHOO.Groups.util.Ajax(sUrl,oCinfig)
oReq.setExpire(10) oReq.get()
34
?????And more things.
35
????Connection Validation
ader("Cache-Control no-store, no-cache")?riptAjax.setSignature(8799827E0-AOEIDJCXICXEHKX
I)
36
????Prioritized Management
objRequest.setPriority(100)
37
?????,???Lazy ConnectionDont Hurry, Be
Lazy.
objRequest.setThreshold(10)objRequest.setTimeout
(10,true)
38
Enterprise Ajax in JAVA
39
Enterprise Ajax in ASP.Net
40
??Thanks
Hedger Wang ??Web http//www.hedgerwow.comMai
l hedgerwang_at_gmail.comYIM hedger14
Write a Comment
User Comments (0)
About PowerShow.com