SlideShare a Scribd company logo
Using Groovy to empower WebRTC
Network Systems
Antón R. Yuste
@antonmry
Agenda
●
What is (and isn't WebRTC)
●
Developing your own WebRTC service
●
Groovy & Network Systems
●
TADHack 2015
Once upon a time...
Forever
There was a time...
●
Where we use to see video by using plug-ins and
external software
●
Instant Messaging was delivered using the same
concepts and Voice = Telephony
●
Suddenly everything changed
WebRTC @ Glance
WebRTC offers real time
communication natively
from a web browser
WebRTC @ Glance
WebRTC capable
browser share, including
Mobile, Tablet and
desktop
61%
WebRTC @ Glance
WebRTC is a
“MediaEngine” with
javascript API
API
WebRTC @ Glance
WebRTC is a technology,
NOT a solution,
AND open source
projects too
So, what is WebRTC?
●
A built-in application program interface that enables
browser-to-browser applications for:
●
voice calling
●
video chat
●
peer to peer of any data
●
Media engine in the browser, accessed by JavaScript,
downloaded from web-server.
●
Collaborative W3C and IETF standardization
The WebRTC tree
IMS, LTE
WWW
VoIP
So, what is WebRTC - Technically Speaking?
PEER CONNECTION
(AUDIO, VIDEO, DATA)
WEB SERVER
(WEBRTC CONTROL)
GATEWAY
PEER CONNECTION
(AUDIO, VIDEO, DATA)
PEER CONNECTION
(AUDIO, VIDEO, DATA)
WEB SERVER
(WEBRTC CONTROL)
What isn't WebRTC - Technically Speaking?
●
No MTI coded media
●
No defined signaling mechanism
It's a Standard
Specification and an
opensource project
Signaling – The Two Approach
SIP over WebSockets JSON over WebSockets
Why JSON, XMPP, * and not SIP?
●
Much more easy
●
There are more developers
●
Language of the web
●
And it’s natively supported by browser
●
Drives more SIP into the network
WebRTC Browser Support: Desktop
WebRTC Regional Browser Support: Desktop
A new Sheriff in town
●
August 20, 2014. Microsoft published a blog post
publicly supporting the ORCT draft.
Browser support
WebRTC Browser Support: Mobile
Consideration
●
Lack of WebRTC Support:
●
SDK/library for Windows Phone and IOS devices
●
Hardware support for Mobile Phone
●
Software encoding & decoding will kill your battery
for VP8
●
New device will benefits from power processor
●
Snapdragon 800 4
●
nVidia Tegra 4
Where we are now?
Is WebRTC ready?
… and more!
Major WebRTC Standard APIs
Acquire audio/video
Communicate Media
Communicate Data
MediaStream/getUserMedia
RTCPeerConnection
RTCDataChannel
MediaStream
●
Represents a stream of audio/video (stream from
camera/mike)
●
Multiple Tracks
●
Use navigator.getUserMedia()
MediaStream
var constraints = {video: true};
function successCallback(stream) {
var video =
document.querySelector("video");
video.src =
window.URL.createObjectURL(stream);
}
function errorCallback(error) {
console.log("navigator.getUserMedia error:
", error);
}
navigator.getUserMedia(constraints,
successCallback, errorCallback);
RTCPeerConnection
●
Centre of WebRTC
Standard API.
●
Peer to Peer
Communication
●
Codec, Security,
bandwidth etc.
RTCPeerConnection
pc = new RTCPeerConnection(null);
pc.onaddstream = gotRemoteStream;
pc.addStream(localStream);
pc.createOffer(gotOffer);
function gotOffer(desc) {
pc.setLocalDescription(desc);
sendOffer(desc);
}
function gotAnswer(desc) {
pc.setRemoteDescription(desc);
}
function gotRemoteStream(e) {
attachMediaStream(remoteVideo, e.stream);
}
RTCDataChannel
●
Arbitrary Data
●
File
●
Text
●
Games
●
API Similar to WebSockets
●
Peer to Peer Data
●
Use SCTP
RTCDataChannel
var pc = new webkitRTCPeerConnection(servers,
{optional: [{RtpDataChannels: true}]});
pc.ondatachannel = function(event) {
receiveChannel = event.channel;
receiveChannel.onmessage = function(event){
document.querySelector("div#receive").innerHTML =
event.data;
};
};
sendChannel = pc.createDataChannel("sendDataChannel",
{reliable: false});
document.querySelector("button#send").onclick = function (){
var data = document.querySelector("textarea#send").value;
sendChannel.send(data);
};
WebRTC Signaling
HTML
App
Browser
HTML
App
Browser
Session Description
Protocol
Signaling? Signaling?
Media(RTCP/RTP)
Caller Callee
Session Description
Protocol
WebRTC Offer/Answer Model
HTML
App
Browser
HTML
App
Browser
How ? How ?
Caller Callee
offer answer
ICE/STUN
Caller Callee
media media
STUN
ICE/TURN
Caller Callee
media
STUN STUN
TURN TURN
The entire exchange in a complicated diagram
How to start using WebRTC API ?
Prerequisites
●
Java 7
●
Maven 3.2+
●
Git
●
Your favorite IDE
●
Chrome browser
●
Internet Connection
Practice
git clone https://github.com/antonmry/SpringIOWebRTCSampleApp.git
ant jetty:run
Follow the mantra…
●
Java is Groovy, Groovy is Java.
●
Flat learning curve for Java developers, start with
straight Java syntax then move on to a groovier syntax
as you feel comfortable.
●
Almost 98% Java code is Groovy code, meaning you
can in most changes rename *.java to *.groovy and it
will work.
Template Engine maps messages in both
directions between applications and network
JSON Template
Engine
SIP message
Application Network
Call
Flow
detail
Components and developer extension points
Template Engine configuration
Package
Criteria
Script
template
Script
template
Script
template
Template Library
Criteria
Criteria
The Console Window
Package configuration
Inbound
INVITE
request
criteria
Inbound INVITE Request Template
TemplateContext passed as an argument
Using Script Library method
Creating a future task executed on successful ME response
Script Library
Groovy method specified in Inbound INVITE request template script
Groovy tips and tricks
●
Use “def” to declare variables and make them local:
def b = "foo“.
●
Simplification of a getter method notation: def factory
= context.webFactory // instead of
context.getWebFactory()
●
Safe navigation operator (?.): def errorCode =
context.webMessage?.header?.error_code
●
Check for a null object: if
(context.webMessage?.payload?.sdp)
Groovy tips and tricks
●
Compile static @groovy.transform.CompileStatic (no
dynamic types, compiles better and faster)
●
Iterators
●
’as’ keyword
●
Closures
●
array and list operators * and *. – called ”spread” and
”spread-dot”
●
GPath – similar to xpath but runs on objects not xml
Groovy scripts troubleshooting
●
Add println statements and see output in the system
out, e.g.: println “from=" + from
●
Use log4j and see output in wsc.log file, e.g.
org.apache.log4j.Logger logger =
org.apache.log4j.Logger.getLogger(getClass())
logger.info(“groovy info: from=“ + from)
●
When an exception is thrown within a Groovy script, a
stack trace will be logged in the wsc.log file.
Groovy scripts troubleshooting
Groovy scripts troubleshooting
Caused by: groovy.lang.MissingPropertyException: No such property: sipReq for class: Script2
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231
)
at Script2.pkg_register_dir_FROM_APP_typ_request_verb_connect_netsvc_default(Script2.groovy:705)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:952)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at groovy.lang.Closure.call(Closure.java:411)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.callGlobal(GroovyScriptEngineImpl.java:411)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.callGlobal(GroovyScriptEngineImpl.java:405)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:394)
...
Groovy scripts validation
Example SIP Request Variable
// Create REGISTER request
def from = getFromAddress(context)
def to = getToAddress(context)
def sipReq = context.sipFactory.createSipRequest("REGISTER",
from, to)
// Set request URI
sipReq.requestURI =
context.sipFactory.createSipAddress(Constants.PROXY_SIP_URI)
.URI
// Set contact user
if (from.URI?.user) {
sipReq.setContactUser(from.URI.user)
}
// Set sip.instance to allow container to use SIP Outbound
// for routing purposes as defined in RFC 5626
def sipInstance = ""<urn:uuid:" +
java.util.UUID.randomUUID() + ">""
sipReq.setSipContactParameter("+sip.instance", sipInstance)
sipReq.setSipContactParameter("reg-id", "1")
context.subSessionStore.put("sip.instance", sipInstance)
sipReq.send()
GRUUs
A GRUU (Globally Routable User-Agent URI) is a SIP URI which
has a few properties.
?
Example SIP Request Variable
sipReq.setHeader("Supported", "gruu")
// P-Charging-Vector example
def icidValue = context.uniqueId
def myIp =
java.net.InetAddress.localHost.hostAddress
sipReq.setHeader("P-Charging-Vector", "icid-
value=" + icidValue +
";icid-generated-at=" + myIp)
Protecting System Performance
by Removing SIP Messages
if (sipResponse.status < 200) {
// Ignore provisional responses
} else if (sipResponse.status < 300)
// Proceed with processing
}
{...
}
Removing a SIP Header in a
Message
sipReq.removeHeader("headername")
Conditionally Passing SIP Headers
in Messages
def myWebParameter =
context.webMessage?.header.?myParameter
if (myWebParameter) {
sipRequest.setHeader("MyHeader",
myWebParameter)
}
REST
●
Asynchronous and synchronous callback responses
●
Support for HTTP and HTTPS
●
Support for all standard REST methods
●
Support for REST calls during message processing or
WebSocket connection establishment
Defining a REST URL Endpoint Constant
public static final MY_REST_URL =
"http://server:port/rest_endpoint"
Referencing the URL Constant
def restRequest =
context.restClient.createRequest(Constants.MY
_REST_URL...);
Creating a REST Request
def myRestRequest =
context.restClient.createRequest(Constants.MY
_REST_URL, "PUT");
Configuring a REST Request Object
myRestRequest.setAccept(APPLICATION_JSON);
myRestRequest.setAcceptLanguage("en-us", "de-
de", "fr-fr");
myRestRequest.addHeader("My Key", "My
Value");
Sending the REST Request
def xml = { mkp.xmlDeclaration() fish
{ name("salmon") price("10") }};
def myRestFuture = myRestRequest.send(xml,
APPLICATION_XML);
Sending the REST Request
context.getTaskBuilder("processResponse").wit
hArg("myRestFuture", restFuture)
.onSuccess(restFuture).build();
context.getTaskBuilder("processResponse").wit
hArg("myRestFuture", restFuture)
.onError(restFuture).build();
REST Response Handler
void processResponse(TemplateContext context)
{
def result =
context.taskArgs.restFuture.get()
if (result.status == 200) {
def fish = result.value()
if (fish.name.text() == "salmon") {
// Continue processing...
}
} else {
// Handle any errors...
}
}
REST Authentication
def myRestAuthRequest =
context.restClient.createRequest(Constants.MY
_REST_URL, "PUT", true);
def username = "myuserid";
def password = [231, 245, 675, 232, 123] as
byte[];
myRestAuthRequest.setCredentials(username,
password);
tadhack.optaresolutions.com
Add easily
telecom services
to your APPs
Industry-
standard SIP
servlet 2.0,
media control
and Java EE
Example SIP POJO (JSR-359)
@SipServlet
public class FooPOJO {
@Invite
public void incomingCall(SipServletRequest request) {
//...
}
@Bye
public void disconnectCall(SipServletResponse response) {
//...
}
}
WebRTC
Summary
●
WebRTC is a great option to implement or add Real
Time Communication services.
●
Groovy is very good in network systems: it provides
flexibility, easy to use and good performance
●
If you like communications & developing, don't miss
TADHack 2015.
Q & A
Thanks!
@antonmry
www.
serviceandnetworkevolution
.com

More Related Content

What's hot

Advanced MQTT and Kura - EclipseCON 2014
Advanced MQTT and Kura - EclipseCON 2014Advanced MQTT and Kura - EclipseCON 2014
Advanced MQTT and Kura - EclipseCON 2014
Eurotech
 
Brushing skills on SignalR for ASP.NET developers
Brushing skills on SignalR for ASP.NET developersBrushing skills on SignalR for ASP.NET developers
Brushing skills on SignalR for ASP.NET developers
ONE BCG
 
WebRTC in action
WebRTC in actionWebRTC in action
WebRTC in action
Tho Q Luong Luong
 
L7 firewall API for Neutron-FWaaS
L7 firewall API for Neutron-FWaaSL7 firewall API for Neutron-FWaaS
L7 firewall API for Neutron-FWaaS
nguyen phuong an
 
VozDigital DevFest 31/10/14
VozDigital DevFest 31/10/14VozDigital DevFest 31/10/14
VozDigital DevFest 31/10/14
javier_fernandez_seco
 
Building a scalable microservice architecture with envoy, kubernetes and istio
Building a scalable microservice architecture with envoy, kubernetes and istioBuilding a scalable microservice architecture with envoy, kubernetes and istio
Building a scalable microservice architecture with envoy, kubernetes and istio
SAMIR BEHARA
 
Matrix, The Year To Date, Ben Parsons, TADSummit 2018
Matrix, The Year To Date, Ben Parsons, TADSummit 2018Matrix, The Year To Date, Ben Parsons, TADSummit 2018
Matrix, The Year To Date, Ben Parsons, TADSummit 2018
Alan Quayle
 
Introduction to Istio Service Mesh
Introduction to Istio Service MeshIntroduction to Istio Service Mesh
Introduction to Istio Service Mesh
Georgios Andrianakis
 
Hyperledger Fabric EVM Integration Feb 20, 2018
Hyperledger Fabric EVM Integration Feb 20, 2018Hyperledger Fabric EVM Integration Feb 20, 2018
Hyperledger Fabric EVM Integration Feb 20, 2018
Arnaud Le Hors
 
Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017
Ulf Lilleengen
 
GÉANT TURN pilot
GÉANT TURN pilotGÉANT TURN pilot
GÉANT TURN pilot
Mihály Mészáros
 
WebRTC
WebRTCWebRTC
WebRTC
Dhruva Sagar
 
Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservices
Ron Barabash
 
Using open source for IoT
Using open source for IoTUsing open source for IoT
Using open source for IoT
Ian Skerrett
 
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)Victor Pascual Ávila
 
Microservices With Istio Service Mesh
Microservices With Istio Service MeshMicroservices With Istio Service Mesh
Microservices With Istio Service Mesh
Natanael Fonseca
 
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
Amir Zmora
 

What's hot (17)

Advanced MQTT and Kura - EclipseCON 2014
Advanced MQTT and Kura - EclipseCON 2014Advanced MQTT and Kura - EclipseCON 2014
Advanced MQTT and Kura - EclipseCON 2014
 
Brushing skills on SignalR for ASP.NET developers
Brushing skills on SignalR for ASP.NET developersBrushing skills on SignalR for ASP.NET developers
Brushing skills on SignalR for ASP.NET developers
 
WebRTC in action
WebRTC in actionWebRTC in action
WebRTC in action
 
L7 firewall API for Neutron-FWaaS
L7 firewall API for Neutron-FWaaSL7 firewall API for Neutron-FWaaS
L7 firewall API for Neutron-FWaaS
 
VozDigital DevFest 31/10/14
VozDigital DevFest 31/10/14VozDigital DevFest 31/10/14
VozDigital DevFest 31/10/14
 
Building a scalable microservice architecture with envoy, kubernetes and istio
Building a scalable microservice architecture with envoy, kubernetes and istioBuilding a scalable microservice architecture with envoy, kubernetes and istio
Building a scalable microservice architecture with envoy, kubernetes and istio
 
Matrix, The Year To Date, Ben Parsons, TADSummit 2018
Matrix, The Year To Date, Ben Parsons, TADSummit 2018Matrix, The Year To Date, Ben Parsons, TADSummit 2018
Matrix, The Year To Date, Ben Parsons, TADSummit 2018
 
Introduction to Istio Service Mesh
Introduction to Istio Service MeshIntroduction to Istio Service Mesh
Introduction to Istio Service Mesh
 
Hyperledger Fabric EVM Integration Feb 20, 2018
Hyperledger Fabric EVM Integration Feb 20, 2018Hyperledger Fabric EVM Integration Feb 20, 2018
Hyperledger Fabric EVM Integration Feb 20, 2018
 
Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017
 
GÉANT TURN pilot
GÉANT TURN pilotGÉANT TURN pilot
GÉANT TURN pilot
 
WebRTC
WebRTCWebRTC
WebRTC
 
Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservices
 
Using open source for IoT
Using open source for IoTUsing open source for IoT
Using open source for IoT
 
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
 
Microservices With Istio Service Mesh
Microservices With Istio Service MeshMicroservices With Istio Service Mesh
Microservices With Istio Service Mesh
 
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
 

Similar to Using Groovy to empower WebRTC Network Systems

JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013
JooinK
 
WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computation
JooinK
 
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes with ...
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes  with ...GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes  with ...
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes with ...
KAI CHU CHUNG
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13Fred Sauer
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
JooinK
 
DIY- computer vision with GWT
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWTFrancesca Tosi
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
Ariya Hidayat
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
Ariya Hidayat
 
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
KAI CHU CHUNG
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitAriya Hidayat
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013
Andy Bunce
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile Web
Ariya Hidayat
 
How to Create a Service in Choreo
How to Create a Service in ChoreoHow to Create a Service in Choreo
How to Create a Service in Choreo
WSO2
 
Web Services and Android - OSSPAC 2009
Web Services and Android - OSSPAC 2009Web Services and Android - OSSPAC 2009
Web Services and Android - OSSPAC 2009
sullis
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Tim Burks
 
Introduction to WebRTC
Introduction to WebRTCIntroduction to WebRTC
Introduction to WebRTC
Art Matsak
 
When third parties stop being polite... and start getting real
When third parties stop being polite... and start getting realWhen third parties stop being polite... and start getting real
When third parties stop being polite... and start getting real
Charles Vazac
 
Real-Time Communication Testing Evolution with WebRTC
Real-Time Communication Testing Evolution with WebRTCReal-Time Communication Testing Evolution with WebRTC
Real-Time Communication Testing Evolution with WebRTC
Alexandre Gouaillard
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microservice
Giulio De Donato
 

Similar to Using Groovy to empower WebRTC Network Systems (20)

JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013
 
WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computation
 
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes with ...
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes  with ...GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes  with ...
GDG Cloud Taipei meetup #50 - Build go kit microservices at kubernetes with ...
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
 
DIY- computer vision with GWT
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWT
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
 
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKit
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile Web
 
How to Create a Service in Choreo
How to Create a Service in ChoreoHow to Create a Service in Choreo
How to Create a Service in Choreo
 
Web Services and Android - OSSPAC 2009
Web Services and Android - OSSPAC 2009Web Services and Android - OSSPAC 2009
Web Services and Android - OSSPAC 2009
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
 
Introduction to WebRTC
Introduction to WebRTCIntroduction to WebRTC
Introduction to WebRTC
 
When third parties stop being polite... and start getting real
When third parties stop being polite... and start getting realWhen third parties stop being polite... and start getting real
When third parties stop being polite... and start getting real
 
Real-Time Communication Testing Evolution with WebRTC
Real-Time Communication Testing Evolution with WebRTCReal-Time Communication Testing Evolution with WebRTC
Real-Time Communication Testing Evolution with WebRTC
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microservice
 

Recently uploaded

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 

Recently uploaded (20)

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 

Using Groovy to empower WebRTC Network Systems

  • 1. Using Groovy to empower WebRTC Network Systems Antón R. Yuste @antonmry
  • 2. Agenda ● What is (and isn't WebRTC) ● Developing your own WebRTC service ● Groovy & Network Systems ● TADHack 2015
  • 3. Once upon a time...
  • 5. There was a time... ● Where we use to see video by using plug-ins and external software ● Instant Messaging was delivered using the same concepts and Voice = Telephony ● Suddenly everything changed
  • 6. WebRTC @ Glance WebRTC offers real time communication natively from a web browser
  • 7. WebRTC @ Glance WebRTC capable browser share, including Mobile, Tablet and desktop 61%
  • 8. WebRTC @ Glance WebRTC is a “MediaEngine” with javascript API API
  • 9. WebRTC @ Glance WebRTC is a technology, NOT a solution, AND open source projects too
  • 10. So, what is WebRTC? ● A built-in application program interface that enables browser-to-browser applications for: ● voice calling ● video chat ● peer to peer of any data ● Media engine in the browser, accessed by JavaScript, downloaded from web-server. ● Collaborative W3C and IETF standardization
  • 11. The WebRTC tree IMS, LTE WWW VoIP
  • 12. So, what is WebRTC - Technically Speaking? PEER CONNECTION (AUDIO, VIDEO, DATA) WEB SERVER (WEBRTC CONTROL) GATEWAY PEER CONNECTION (AUDIO, VIDEO, DATA) PEER CONNECTION (AUDIO, VIDEO, DATA) WEB SERVER (WEBRTC CONTROL)
  • 13. What isn't WebRTC - Technically Speaking? ● No MTI coded media ● No defined signaling mechanism It's a Standard Specification and an opensource project
  • 14. Signaling – The Two Approach SIP over WebSockets JSON over WebSockets
  • 15. Why JSON, XMPP, * and not SIP? ● Much more easy ● There are more developers ● Language of the web ● And it’s natively supported by browser ● Drives more SIP into the network
  • 17. WebRTC Regional Browser Support: Desktop
  • 18. A new Sheriff in town ● August 20, 2014. Microsoft published a blog post publicly supporting the ORCT draft.
  • 21. Consideration ● Lack of WebRTC Support: ● SDK/library for Windows Phone and IOS devices ● Hardware support for Mobile Phone ● Software encoding & decoding will kill your battery for VP8 ● New device will benefits from power processor ● Snapdragon 800 4 ● nVidia Tegra 4
  • 22. Where we are now?
  • 23. Is WebRTC ready? … and more!
  • 24. Major WebRTC Standard APIs Acquire audio/video Communicate Media Communicate Data MediaStream/getUserMedia RTCPeerConnection RTCDataChannel
  • 25. MediaStream ● Represents a stream of audio/video (stream from camera/mike) ● Multiple Tracks ● Use navigator.getUserMedia()
  • 26. MediaStream var constraints = {video: true}; function successCallback(stream) { var video = document.querySelector("video"); video.src = window.URL.createObjectURL(stream); } function errorCallback(error) { console.log("navigator.getUserMedia error: ", error); } navigator.getUserMedia(constraints, successCallback, errorCallback);
  • 27. RTCPeerConnection ● Centre of WebRTC Standard API. ● Peer to Peer Communication ● Codec, Security, bandwidth etc.
  • 28. RTCPeerConnection pc = new RTCPeerConnection(null); pc.onaddstream = gotRemoteStream; pc.addStream(localStream); pc.createOffer(gotOffer); function gotOffer(desc) { pc.setLocalDescription(desc); sendOffer(desc); } function gotAnswer(desc) { pc.setRemoteDescription(desc); } function gotRemoteStream(e) { attachMediaStream(remoteVideo, e.stream); }
  • 29. RTCDataChannel ● Arbitrary Data ● File ● Text ● Games ● API Similar to WebSockets ● Peer to Peer Data ● Use SCTP
  • 30. RTCDataChannel var pc = new webkitRTCPeerConnection(servers, {optional: [{RtpDataChannels: true}]}); pc.ondatachannel = function(event) { receiveChannel = event.channel; receiveChannel.onmessage = function(event){ document.querySelector("div#receive").innerHTML = event.data; }; }; sendChannel = pc.createDataChannel("sendDataChannel", {reliable: false}); document.querySelector("button#send").onclick = function (){ var data = document.querySelector("textarea#send").value; sendChannel.send(data); };
  • 31. WebRTC Signaling HTML App Browser HTML App Browser Session Description Protocol Signaling? Signaling? Media(RTCP/RTP) Caller Callee Session Description Protocol
  • 35. The entire exchange in a complicated diagram
  • 36. How to start using WebRTC API ?
  • 37. Prerequisites ● Java 7 ● Maven 3.2+ ● Git ● Your favorite IDE ● Chrome browser ● Internet Connection
  • 39. Follow the mantra… ● Java is Groovy, Groovy is Java. ● Flat learning curve for Java developers, start with straight Java syntax then move on to a groovier syntax as you feel comfortable. ● Almost 98% Java code is Groovy code, meaning you can in most changes rename *.java to *.groovy and it will work.
  • 40. Template Engine maps messages in both directions between applications and network JSON Template Engine SIP message Application Network
  • 42. Components and developer extension points
  • 46. Inbound INVITE Request Template TemplateContext passed as an argument Using Script Library method Creating a future task executed on successful ME response
  • 47. Script Library Groovy method specified in Inbound INVITE request template script
  • 48. Groovy tips and tricks ● Use “def” to declare variables and make them local: def b = "foo“. ● Simplification of a getter method notation: def factory = context.webFactory // instead of context.getWebFactory() ● Safe navigation operator (?.): def errorCode = context.webMessage?.header?.error_code ● Check for a null object: if (context.webMessage?.payload?.sdp)
  • 49. Groovy tips and tricks ● Compile static @groovy.transform.CompileStatic (no dynamic types, compiles better and faster) ● Iterators ● ’as’ keyword ● Closures ● array and list operators * and *. – called ”spread” and ”spread-dot” ● GPath – similar to xpath but runs on objects not xml
  • 50. Groovy scripts troubleshooting ● Add println statements and see output in the system out, e.g.: println “from=" + from ● Use log4j and see output in wsc.log file, e.g. org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(getClass()) logger.info(“groovy info: from=“ + from) ● When an exception is thrown within a Groovy script, a stack trace will be logged in the wsc.log file.
  • 52. Groovy scripts troubleshooting Caused by: groovy.lang.MissingPropertyException: No such property: sipReq for class: Script2 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231 ) at Script2.pkg_register_dir_FROM_APP_typ_request_verb_connect_netsvc_default(Script2.groovy:705) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:952) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) at groovy.lang.Closure.call(Closure.java:411) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.callGlobal(GroovyScriptEngineImpl.java:411) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.callGlobal(GroovyScriptEngineImpl.java:405) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:394) ...
  • 54. Example SIP Request Variable // Create REGISTER request def from = getFromAddress(context) def to = getToAddress(context) def sipReq = context.sipFactory.createSipRequest("REGISTER", from, to) // Set request URI sipReq.requestURI = context.sipFactory.createSipAddress(Constants.PROXY_SIP_URI) .URI // Set contact user if (from.URI?.user) { sipReq.setContactUser(from.URI.user) } // Set sip.instance to allow container to use SIP Outbound // for routing purposes as defined in RFC 5626 def sipInstance = ""<urn:uuid:" + java.util.UUID.randomUUID() + ">"" sipReq.setSipContactParameter("+sip.instance", sipInstance) sipReq.setSipContactParameter("reg-id", "1") context.subSessionStore.put("sip.instance", sipInstance) sipReq.send()
  • 55. GRUUs A GRUU (Globally Routable User-Agent URI) is a SIP URI which has a few properties. ?
  • 56. Example SIP Request Variable sipReq.setHeader("Supported", "gruu") // P-Charging-Vector example def icidValue = context.uniqueId def myIp = java.net.InetAddress.localHost.hostAddress sipReq.setHeader("P-Charging-Vector", "icid- value=" + icidValue + ";icid-generated-at=" + myIp)
  • 57. Protecting System Performance by Removing SIP Messages if (sipResponse.status < 200) { // Ignore provisional responses } else if (sipResponse.status < 300) // Proceed with processing } {... }
  • 58. Removing a SIP Header in a Message sipReq.removeHeader("headername")
  • 59. Conditionally Passing SIP Headers in Messages def myWebParameter = context.webMessage?.header.?myParameter if (myWebParameter) { sipRequest.setHeader("MyHeader", myWebParameter) }
  • 60. REST ● Asynchronous and synchronous callback responses ● Support for HTTP and HTTPS ● Support for all standard REST methods ● Support for REST calls during message processing or WebSocket connection establishment
  • 61. Defining a REST URL Endpoint Constant public static final MY_REST_URL = "http://server:port/rest_endpoint" Referencing the URL Constant def restRequest = context.restClient.createRequest(Constants.MY _REST_URL...);
  • 62. Creating a REST Request def myRestRequest = context.restClient.createRequest(Constants.MY _REST_URL, "PUT");
  • 63. Configuring a REST Request Object myRestRequest.setAccept(APPLICATION_JSON); myRestRequest.setAcceptLanguage("en-us", "de- de", "fr-fr"); myRestRequest.addHeader("My Key", "My Value");
  • 64. Sending the REST Request def xml = { mkp.xmlDeclaration() fish { name("salmon") price("10") }}; def myRestFuture = myRestRequest.send(xml, APPLICATION_XML);
  • 65. Sending the REST Request context.getTaskBuilder("processResponse").wit hArg("myRestFuture", restFuture) .onSuccess(restFuture).build(); context.getTaskBuilder("processResponse").wit hArg("myRestFuture", restFuture) .onError(restFuture).build();
  • 66. REST Response Handler void processResponse(TemplateContext context) { def result = context.taskArgs.restFuture.get() if (result.status == 200) { def fish = result.value() if (fish.name.text() == "salmon") { // Continue processing... } } else { // Handle any errors... } }
  • 67. REST Authentication def myRestAuthRequest = context.restClient.createRequest(Constants.MY _REST_URL, "PUT", true); def username = "myuserid"; def password = [231, 245, 675, 232, 123] as byte[]; myRestAuthRequest.setCredentials(username, password);
  • 68.
  • 72. Example SIP POJO (JSR-359) @SipServlet public class FooPOJO { @Invite public void incomingCall(SipServletRequest request) { //... } @Bye public void disconnectCall(SipServletResponse response) { //... } }
  • 74. Summary ● WebRTC is a great option to implement or add Real Time Communication services. ● Groovy is very good in network systems: it provides flexibility, easy to use and good performance ● If you like communications & developing, don't miss TADHack 2015.
  • 75. Q & A