REST, Web Sockets, Server-sent Events

Preview:

DESCRIPTION

REST Web Sockets Server-sent Events This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2013. http://www.ivanomalavolta.com

Citation preview

https://jersey.dev.java.net

https://jersey.dev.java.net

@Path

InputStream

@Consumes @PathParam

@pathParam

@PathParam

id

@Consumes

@POST @PUT

@Produces

@GET @POST

@PUT

• @FormParams

POST PUT

• @HEAD

• @CookieParam

• @HeaderParam

open event stream

event event

Server

event event

event event

<EventSource>

onmessage

onmessage

onmessage

Browser

http://s

lidesha.r

e/L

eN

ohX

– ws://

– wss://

http://www.w3.org/TR/2009/WD-websockets-20091222/

var source = new EventSource(“http://some.url”);

var handler = function(event){

console.log(event.data);

console.log(event.id);

console.log(event.origin);

console.log(event.lastEventId);

}

source.addEventListener(‘myEvent', handler, false);

<fieldName>: <fieldValue>\n

fieldName

Recommended