SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
WebSockets
1
WebSockets

WebSockets
and browser-based real-time communications
Peter Dunkley, Technical Director, Crocodile RCS Ltd

Email:
Twitter:

peter.dunkley@crocodilertc.net
@pdunkley
Evolution on the web
WebSocket and
WebRTC
implementations
become available

Sir Tim Berners-Lee
creates HTML. Web
-pages are static

W3C produces the
DOM1 specification

1990

Microsoft and Netscape
introduce different
mechanisms for DHTML

1996

1998

2004

2011
Google uses Ajax
in Gmail (W3C
releases 1st draft in
2006) – the dawn
of web-apps
Revolution in telecoms
The revolution
Before today the operators (big and small) had
full control over real-time communications
because it was hard to do and substantial
infrastructure investment was required.

Claude Chappe
invented the optical
telegraph
Alexander
Graham
Bell patents
the telephone

1792

1837 1876

1919 1960s >

1990s >

Rotary dial
enters
service
First commercial
electrical telegraph
created by
Cooke and
Wheatstone

From the 1990s onwards
voice started to be carried
on technologies developed
for data networks such as
ATM and IP

From the 1960s
onwards digital
exchanges start to
appear

1963: DTMF
enters service

2011

WebSocket and
WebRTC
implementations
become
available
Demo #1: Click-2-call
●

A simple addition to any commercial web-site

●

Makes use of WebSocket and WebRTC

●

Can be enhanced to make the calling
experience richer
–

Context aware communication

–

A fun queuing experience
Demo #1: Click-2-call
What are WebSockets?
The WebSocket Protocol enables two-way communication
between a client running untrusted code in a controlled
environment to a remote host that has opted-in to
communications from that code.
RFC 6455, I. Fette (Google, Inc) et al, December 2011

http://tools.ietf.org/html/rfc6455
To enable Web applications to maintain bidirectional
communications with server-side processes, this
specification introduces the WebSocket interface.
The WebSocket API (W3C Candidate
Recommendation), I. Hickson (Google, Inc),
20 September 2012

http://www.w3.org/TR/websockets
Aren't there other options?
●

Ajax
–
–

The web-server needs to process (and run scripts, lookup
databases, etc) for each connection

–

●

You need to open a new connection each time you refresh

With WebSockets you open the connection and keep it open
as long as you need it

BOSH
–

Not an IETF standard

–

Less widely supported than WebSocket

–

WebSocket requires a single network connection, BOSH uses
two
Safe and secure
●

A raw TCP/UDP API for Javascript would be
dangerous
–

●

The WebSocket protocol is asynchronous
–

●

Connections can only be established from the client side

Data from client to server is masked
–

●

There would be no need to fool users into installing trojans

Prevents in-line proxies from mistaking the data for HTTP
and modifying it

Can be secured using TLS
Easy to use
●

Very simple API
–
–

Methods: close(), send()

–
●

Constructor creates (opens) the connection
Events: onopen(), onerror(), onclose()

Has the advantages of TCP and UDP
–

–
●

Data is framed – no need to parse the stream to work out
where messages start and end
Frame delivery is guaranteed and in-order

Interpretation of the frames is based on
subprotocol not TCP or UDP port
Opening a connection (Handshake)
Request from client (browser)
GET wss://edge00.crocodilertc.net/4m9e4ipsfd8uh0leg0kr HTTP/1.1
Origin: https://www.crocodiletalk.com
Host: edge00.crocodilertc.net
Sec­WebSocket­Key: ywV2YxcaL0DMDVPyeHYj3Q==
Upgrade: websocket
Sec­WebSocket­Protocol: sip
Connection: Upgrade
Sec­WebSocket­Version: 13

Response from server
HTTP/1.1 101 Switching Protocols
Access­Control­Allow­Origin: https://www.crocodiletalk.com
Connection: upgrade
Sec­WebSocket­Accept: 9H9dBstuq+Y4Be2Ql7WWkV6tnjA=
Sec­WebSocket­Protocol: sip
Upgrade: websocket

The browser API handles this for you
Controlling connections
●

Two types of frame
–

Data frames

–

Control frames
●

Close
If you receive a close on a connection that you have not send a close on, send a
close on that connection

●

Ping
If you receive a ping on a connection send a pong on that connection

●

Pong

The browser API handles this for you
Sending/receiving frames
0
1
2
3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len |
Extended payload length
|
|I|S|S|S| (4) |A|
(7)
|
(16/64)
|
|N|V|V|V|
|S|
|
(if payload len==126/127)
|
| |1|2|3|
|K|
|
|
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
|
Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
|
|Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued)
|
Payload Data
|
+-------------------------------- - - - - - - - - - - - - - - - +
:
Payload Data continued ...
:
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
|
Payload Data continued ...
|
+---------------------------------------------------------------+

RFC 6455, section 5.2

The browser API handles this for you
Proxies and subprotocols
●

Proxies
–

In-line proxies may be an issue
●

●

–

Using TLS avoids the issue and is good-practice anyway

Configured proxies
●

●

Masking helps avoid frame corruption, but sometimes the handshake
fails

Must support the CONNECT HTTP request

Subprotocols
–

http://www.iana.org/assignments/websocket/websocket.xml
Opensource projects
●

Node.js
–

●

SIP Servers
–

●

JAIN-SIP-Javascript, JsSIP, QoffeeSIP, sipml5

XMPP Servers (and connection managers)
–

●

Asterisk, Kamailio, OverSIP, reSIPprocate

SIP Clients
–

●

Many WebSocket libraries available

ejabberd-websockets, node-xmpp-bosh, openfire-websockets

XMPP Clients
–

JSJaC, Strophe
Demo #2: Web Communicator
●

A fully-featured unified communications client

●

Makes use of WebSocket and WebRTC

●

Multiple WebSocket connections for multiple
protocols
–

●

●

MSRP (file-transfer), SIP (session signalling), and XMPP (messaging
and presence)

No need to create a new application for every target
platform
Browsers without WebRTC support can still use
WebSocket for file-transfer, messaging, presence,
and other data
Demo #2: Web Communicator
WebRTC
There are a number of proprietary implementations that
provide direct interactive rich communication using audio,
video, collaboration, games, etc. between two peers' webbrowsers. These are not interoperable, as they require nonstandard extensions or plugins to work. There is a desire to
standardize the basis for such communication so that
interoperable communication can be established between
any compatible browsers.
Real-Time Communication in WEBBrowsers (rtcweb) 2013-03-13 charter

http://tools.ietf.org/wg/rtcweb/
WebRTC has a rich API
●

Media Capture and Streams
–
–

●

Audio, video, and screen-sharing
http://www.w3.org/TR/mediacapture-streams/

MediaStream Recording
–

●

http://www.w3.org/TR/mediastream-recording/

WebRTC
–

Data can be exchanged too

–

http://www.w3.org/TR/webrtc/

Available (to varying degrees) in Chrome and Firefox stable
The WebRTC APIs are not enough
●

●

Google made a controversial (but very wise)
decision not to specify how the signalling
should work
Signalling is required
–

To discover who to communicate with

–

To exchange information on what the communication should
be (audio, data, video, and codecs)

–

Even the simplest, proprietary, RESTful
The signalling trapezoid/triangle
Signalling

Server

Sig
nal
ling

Server

Browser

WebRTC media or DataChannel

Browser
Signalling options
●

Open standards are usually best
–

–

XMPP over WebSocket,
http://tools.ietf.org/html/draft-moffitt-xmpp-over-websocket

–
●

SIP over WebSocket,
http://tools.ietf.org/html/draft-ietf-sipcore-sip-websocket

OpenPeer, http://openpeer.org/

The WebRTC API is easy but signalling is often hard
–

There are many open-source libraries that do the signalling

–

The library APIs vary in complexity to meet every need

–

Hosted infrastructure lets you add real-time communications to your
website without having to build a network yourself
Demo #3: Chrome Developer Tools
●

Google Chrome provides a range of tools to
help you create and debug applications

●

You can add view code and add breakpoints

●

You can modify code and view debug

●

You can examine what is happening on the
wire
–

●

The Network → WebSockets view can be particularly helpful
– especially if using TLS

...
Demo #3: Chrome Developer Tools
Dealing with firewalls
●

WebRTC is peer-to-peer technology

●

Sometimes firewall and NAT devices get in the way

●

ICE (Interactive Connectivity Establishment) is
mandatory
–
–

●

STUN (Session Traversal Utilities for NAT) helps in most cases
TURN (Traversal Using Relays around NAT) helps when STUN doesn't

If a firewall is specifically configured to block real-time
communications your options are limited
Applications of this technology
●

Telecommunications
–

●

Distance learning
–

●

File-sharing, collaboration

Gaming
–

●

Providing medical services out-of-hours and to remote locations

Peer-to-peer applications
–

●

Virtual colleges and universities

Telemedicine
–

●

Unified communications, corporate infrastructure, call centres

Multi-player interactive (with and without servers)

...
Browser support today
http://caniuse.com/

IE

FF

Chrome

Safari

O

iOS
Safari

O
Mini

Android
Browser

Blackberry
Browser

O
Mobile

Chrome
for
Android

FF for
Android

WebSocket

10.0

6.0

14.0

6.0

12.1

6.0

-

-

7.0

12.1

27.0

22.0

WebRTC

-

17.0***

21.0***

-

-*

-

-

-

10.0***

-*

-**

-

* Partial support for GetUserMedia is in some old versions
** WebRTC is known to work in the latest version if you set a flag
*** As WebRTC is still under development later browser versions will be more stable and have more features
Desktop and mobile apps
●

This technology isn't just for browsers

●

Native WebRTC libraries are available
–
–

●

Mobile: Android and iOS
Desktop: Linux, OS X, and Windows

Native WebSocket libraries are available
–

WebSockets are a sensible option for mobile app developers
who want a safe way to exchange data with servers
Questions?
Code:

https://github.com/crocodilertc

Email:

peter.dunkley@crocodilertc.net

Twitter:

@pdunkley
Crocodile WebRTC SDK and Network
www.crocodilertc.net

Weitere ähnliche Inhalte

Was ist angesagt?

MikroTik BGP Security - MUM 2014 (rofiq fauzi)
MikroTik BGP Security - MUM 2014 (rofiq fauzi)MikroTik BGP Security - MUM 2014 (rofiq fauzi)
MikroTik BGP Security - MUM 2014 (rofiq fauzi)Rofiq Fauzi
 
Mikrotik basic configuration
Mikrotik basic configurationMikrotik basic configuration
Mikrotik basic configurationTola LENG
 
JAX 2014 - M2M for Java Developers with MQTT
JAX 2014 - M2M for Java Developers with MQTTJAX 2014 - M2M for Java Developers with MQTT
JAX 2014 - M2M for Java Developers with MQTTDominik Obermaier
 
MTCNA - MikroTik Certified Network Associate - v2
MTCNA - MikroTik Certified Network Associate - v2MTCNA - MikroTik Certified Network Associate - v2
MTCNA - MikroTik Certified Network Associate - v2Yaser Rahmati
 
MQTT with Java - a protocol for IoT and M2M communication
MQTT with Java - a protocol for IoT and M2M communicationMQTT with Java - a protocol for IoT and M2M communication
MQTT with Java - a protocol for IoT and M2M communicationChristian Götz
 
WebRTC Real time media P2P, Server, Infrastructure, and Platform
WebRTC Real time media P2P, Server, Infrastructure, and PlatformWebRTC Real time media P2P, Server, Infrastructure, and Platform
WebRTC Real time media P2P, Server, Infrastructure, and PlatformRyan Jespersen
 
MikroTik Internet Route Filter
MikroTik Internet Route FilterMikroTik Internet Route Filter
MikroTik Internet Route FilterTeav Sovandara
 
Mikrotik Network Simulator (MUM Presentation Material 2013)
Mikrotik Network Simulator (MUM Presentation Material 2013)Mikrotik Network Simulator (MUM Presentation Material 2013)
Mikrotik Network Simulator (MUM Presentation Material 2013)Rofiq Fauzi
 
Keeping your rack cool
Keeping your rack cool Keeping your rack cool
Keeping your rack cool Pavel Odintsov
 
Apache Httpd and TLS certificates validations
Apache Httpd and TLS certificates validationsApache Httpd and TLS certificates validations
Apache Httpd and TLS certificates validationsJean-Frederic Clere
 
Understanding Open vSwitch
Understanding Open vSwitch Understanding Open vSwitch
Understanding Open vSwitch YongKi Kim
 
DeiC DDoS Prevention System - DDPS
DeiC DDoS Prevention System - DDPSDeiC DDoS Prevention System - DDPS
DeiC DDoS Prevention System - DDPSPavel Odintsov
 
OpenStack networking
OpenStack networkingOpenStack networking
OpenStack networkingSim Janghoon
 

Was ist angesagt? (20)

MikroTik BGP Security - MUM 2014 (rofiq fauzi)
MikroTik BGP Security - MUM 2014 (rofiq fauzi)MikroTik BGP Security - MUM 2014 (rofiq fauzi)
MikroTik BGP Security - MUM 2014 (rofiq fauzi)
 
Mikrotik basic configuration
Mikrotik basic configurationMikrotik basic configuration
Mikrotik basic configuration
 
JAX 2014 - M2M for Java Developers with MQTT
JAX 2014 - M2M for Java Developers with MQTTJAX 2014 - M2M for Java Developers with MQTT
JAX 2014 - M2M for Java Developers with MQTT
 
Webrtc overview
Webrtc overviewWebrtc overview
Webrtc overview
 
MTCNA - MikroTik Certified Network Associate - v2
MTCNA - MikroTik Certified Network Associate - v2MTCNA - MikroTik Certified Network Associate - v2
MTCNA - MikroTik Certified Network Associate - v2
 
MikroTik Firewall : Securing your Router with Port Knocking
MikroTik Firewall : Securing your Router with Port KnockingMikroTik Firewall : Securing your Router with Port Knocking
MikroTik Firewall : Securing your Router with Port Knocking
 
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on KamailioAstricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
 
Mikrotik load balansing
Mikrotik load balansingMikrotik load balansing
Mikrotik load balansing
 
MQTT with Java - a protocol for IoT and M2M communication
MQTT with Java - a protocol for IoT and M2M communicationMQTT with Java - a protocol for IoT and M2M communication
MQTT with Java - a protocol for IoT and M2M communication
 
BGP on mikrotik
BGP on mikrotikBGP on mikrotik
BGP on mikrotik
 
WebRTC Real time media P2P, Server, Infrastructure, and Platform
WebRTC Real time media P2P, Server, Infrastructure, and PlatformWebRTC Real time media P2P, Server, Infrastructure, and Platform
WebRTC Real time media P2P, Server, Infrastructure, and Platform
 
MikroTik Internet Route Filter
MikroTik Internet Route FilterMikroTik Internet Route Filter
MikroTik Internet Route Filter
 
Mikrotik Network Simulator (MUM Presentation Material 2013)
Mikrotik Network Simulator (MUM Presentation Material 2013)Mikrotik Network Simulator (MUM Presentation Material 2013)
Mikrotik Network Simulator (MUM Presentation Material 2013)
 
Keeping your rack cool
Keeping your rack cool Keeping your rack cool
Keeping your rack cool
 
Apache Httpd and TLS certificates validations
Apache Httpd and TLS certificates validationsApache Httpd and TLS certificates validations
Apache Httpd and TLS certificates validations
 
Understanding Open vSwitch
Understanding Open vSwitch Understanding Open vSwitch
Understanding Open vSwitch
 
DeiC DDoS Prevention System - DDPS
DeiC DDoS Prevention System - DDPSDeiC DDoS Prevention System - DDPS
DeiC DDoS Prevention System - DDPS
 
Mikro tik advanced training
Mikro tik advanced trainingMikro tik advanced training
Mikro tik advanced training
 
OpenStack networking
OpenStack networkingOpenStack networking
OpenStack networking
 
BRAC case study on mikrotik router for NGO network
BRAC case study on mikrotik router for NGO networkBRAC case study on mikrotik router for NGO network
BRAC case study on mikrotik router for NGO network
 

Ähnlich wie WebSockets and Real-Time Communications

[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTCGiacomo Vacca
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Marcin Bielak
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)Ericom Software
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQICS
 
WebRTC overview
WebRTC overviewWebRTC overview
WebRTC overviewRouyun Pan
 
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
 
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?Julien Vermillard
 
Building the Internet of Things with Eclipse IoT - IoTBE meetup
Building the Internet of Things with Eclipse IoT - IoTBE meetupBuilding the Internet of Things with Eclipse IoT - IoTBE meetup
Building the Internet of Things with Eclipse IoT - IoTBE meetupBenjamin Cabé
 
WebRTC, another Web?
WebRTC, another Web?WebRTC, another Web?
WebRTC, another Web?Hui Fan
 
WebRTC: A front-end perspective
WebRTC: A front-end perspectiveWebRTC: A front-end perspective
WebRTC: A front-end perspectiveshwetank
 
WebRTC standards update - November 2014
WebRTC standards update - November 2014WebRTC standards update - November 2014
WebRTC standards update - November 2014Victor Pascual Ávila
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Adam Dunkels
 

Ähnlich wie WebSockets and Real-Time Communications (20)

DevCon 5 (December 2013) - WebRTC & WebSockets
DevCon 5 (December 2013) - WebRTC & WebSocketsDevCon 5 (December 2013) - WebRTC & WebSockets
DevCon 5 (December 2013) - WebRTC & WebSockets
 
WebRTC Seminar Report
WebRTC  Seminar ReportWebRTC  Seminar Report
WebRTC Seminar Report
 
Asterisk World (January 2014) - Taking Enterprise Telephony into the Web World
Asterisk World (January 2014) - Taking Enterprise Telephony into the Web WorldAsterisk World (January 2014) - Taking Enterprise Telephony into the Web World
Asterisk World (January 2014) - Taking Enterprise Telephony into the Web World
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
 
WebRTC in action
WebRTC in actionWebRTC in action
WebRTC in action
 
DevCon5 (July 2014) - Intro to WebRTC
DevCon5 (July 2014) - Intro to WebRTCDevCon5 (July 2014) - Intro to WebRTC
DevCon5 (July 2014) - Intro to WebRTC
 
WebRTC
WebRTCWebRTC
WebRTC
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
 
WebRTC overview
WebRTC overviewWebRTC overview
WebRTC overview
 
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)
 
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
Iot Conference Berlin M2M,IoT, device management: one protocol to rule them all?
 
Building the Internet of Things with Eclipse IoT - IoTBE meetup
Building the Internet of Things with Eclipse IoT - IoTBE meetupBuilding the Internet of Things with Eclipse IoT - IoTBE meetup
Building the Internet of Things with Eclipse IoT - IoTBE meetup
 
ITSPA May 2013 - WebRTC, TURN, and WebSocket
ITSPA May 2013 - WebRTC, TURN, and WebSocketITSPA May 2013 - WebRTC, TURN, and WebSocket
ITSPA May 2013 - WebRTC, TURN, and WebSocket
 
WebRTC
WebRTCWebRTC
WebRTC
 
WebRTC, another Web?
WebRTC, another Web?WebRTC, another Web?
WebRTC, another Web?
 
WebRTC: A front-end perspective
WebRTC: A front-end perspectiveWebRTC: A front-end perspective
WebRTC: A front-end perspective
 
WebRTC standards update - November 2014
WebRTC standards update - November 2014WebRTC standards update - November 2014
WebRTC standards update - November 2014
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
 

Mehr von Crocodile WebRTC SDK and Cloud Signalling Network

Mehr von Crocodile WebRTC SDK and Cloud Signalling Network (9)

DevCon5 (July 2014) - Acision SDK
DevCon5 (July 2014) - Acision SDKDevCon5 (July 2014) - Acision SDK
DevCon5 (July 2014) - Acision SDK
 
WebRTC Summit (June 2014) - WebRTC Interoperability (and why it is important)
WebRTC Summit (June 2014) - WebRTC Interoperability (and why it is important)WebRTC Summit (June 2014) - WebRTC Interoperability (and why it is important)
WebRTC Summit (June 2014) - WebRTC Interoperability (and why it is important)
 
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTCKamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
 
WebRTC Conference and Expo (November 2013) - Signalling Workshop
WebRTC Conference and Expo (November 2013)  - Signalling WorkshopWebRTC Conference and Expo (November 2013)  - Signalling Workshop
WebRTC Conference and Expo (November 2013) - Signalling Workshop
 
WebRTC Summit November 2013 - WebRTC Interoperability (and why it is important)
WebRTC Summit November 2013 - WebRTC Interoperability (and why it is important)WebRTC Summit November 2013 - WebRTC Interoperability (and why it is important)
WebRTC Summit November 2013 - WebRTC Interoperability (and why it is important)
 
VUC 24-May-2013 - Crocodile
VUC 24-May-2013 - CrocodileVUC 24-May-2013 - Crocodile
VUC 24-May-2013 - Crocodile
 
Kamailio World 2013 - SIP and MSRP over WebSocket
Kamailio World 2013 - SIP and MSRP over WebSocketKamailio World 2013 - SIP and MSRP over WebSocket
Kamailio World 2013 - SIP and MSRP over WebSocket
 
FOSDEM 2013 - SIP and MSRP over WebSocket in Kamailio
FOSDEM 2013 - SIP and MSRP over WebSocket in KamailioFOSDEM 2013 - SIP and MSRP over WebSocket in Kamailio
FOSDEM 2013 - SIP and MSRP over WebSocket in Kamailio
 
Crocodile RTC Launch (Google Campus) - 1: Introduction
Crocodile RTC Launch (Google Campus) - 1: IntroductionCrocodile RTC Launch (Google Campus) - 1: Introduction
Crocodile RTC Launch (Google Campus) - 1: Introduction
 

Kürzlich hochgeladen

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Kürzlich hochgeladen (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

WebSockets and Real-Time Communications

  • 2. WebSockets WebSockets and browser-based real-time communications Peter Dunkley, Technical Director, Crocodile RCS Ltd Email: Twitter: peter.dunkley@crocodilertc.net @pdunkley
  • 3. Evolution on the web WebSocket and WebRTC implementations become available Sir Tim Berners-Lee creates HTML. Web -pages are static W3C produces the DOM1 specification 1990 Microsoft and Netscape introduce different mechanisms for DHTML 1996 1998 2004 2011 Google uses Ajax in Gmail (W3C releases 1st draft in 2006) – the dawn of web-apps
  • 4. Revolution in telecoms The revolution Before today the operators (big and small) had full control over real-time communications because it was hard to do and substantial infrastructure investment was required. Claude Chappe invented the optical telegraph Alexander Graham Bell patents the telephone 1792 1837 1876 1919 1960s > 1990s > Rotary dial enters service First commercial electrical telegraph created by Cooke and Wheatstone From the 1990s onwards voice started to be carried on technologies developed for data networks such as ATM and IP From the 1960s onwards digital exchanges start to appear 1963: DTMF enters service 2011 WebSocket and WebRTC implementations become available
  • 5. Demo #1: Click-2-call ● A simple addition to any commercial web-site ● Makes use of WebSocket and WebRTC ● Can be enhanced to make the calling experience richer – Context aware communication – A fun queuing experience
  • 7. What are WebSockets? The WebSocket Protocol enables two-way communication between a client running untrusted code in a controlled environment to a remote host that has opted-in to communications from that code. RFC 6455, I. Fette (Google, Inc) et al, December 2011 http://tools.ietf.org/html/rfc6455 To enable Web applications to maintain bidirectional communications with server-side processes, this specification introduces the WebSocket interface. The WebSocket API (W3C Candidate Recommendation), I. Hickson (Google, Inc), 20 September 2012 http://www.w3.org/TR/websockets
  • 8. Aren't there other options? ● Ajax – – The web-server needs to process (and run scripts, lookup databases, etc) for each connection – ● You need to open a new connection each time you refresh With WebSockets you open the connection and keep it open as long as you need it BOSH – Not an IETF standard – Less widely supported than WebSocket – WebSocket requires a single network connection, BOSH uses two
  • 9. Safe and secure ● A raw TCP/UDP API for Javascript would be dangerous – ● The WebSocket protocol is asynchronous – ● Connections can only be established from the client side Data from client to server is masked – ● There would be no need to fool users into installing trojans Prevents in-line proxies from mistaking the data for HTTP and modifying it Can be secured using TLS
  • 10. Easy to use ● Very simple API – – Methods: close(), send() – ● Constructor creates (opens) the connection Events: onopen(), onerror(), onclose() Has the advantages of TCP and UDP – – ● Data is framed – no need to parse the stream to work out where messages start and end Frame delivery is guaranteed and in-order Interpretation of the frames is based on subprotocol not TCP or UDP port
  • 11. Opening a connection (Handshake) Request from client (browser) GET wss://edge00.crocodilertc.net/4m9e4ipsfd8uh0leg0kr HTTP/1.1 Origin: https://www.crocodiletalk.com Host: edge00.crocodilertc.net Sec­WebSocket­Key: ywV2YxcaL0DMDVPyeHYj3Q== Upgrade: websocket Sec­WebSocket­Protocol: sip Connection: Upgrade Sec­WebSocket­Version: 13 Response from server HTTP/1.1 101 Switching Protocols Access­Control­Allow­Origin: https://www.crocodiletalk.com Connection: upgrade Sec­WebSocket­Accept: 9H9dBstuq+Y4Be2Ql7WWkV6tnjA= Sec­WebSocket­Protocol: sip Upgrade: websocket The browser API handles this for you
  • 12. Controlling connections ● Two types of frame – Data frames – Control frames ● Close If you receive a close on a connection that you have not send a close on, send a close on that connection ● Ping If you receive a ping on a connection send a pong on that connection ● Pong The browser API handles this for you
  • 13. Sending/receiving frames 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-------+-+-------------+-------------------------------+ |F|R|R|R| opcode|M| Payload len | Extended payload length | |I|S|S|S| (4) |A| (7) | (16/64) | |N|V|V|V| |S| | (if payload len==126/127) | | |1|2|3| |K| | | +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - + | Extended payload length continued, if payload len == 127 | + - - - - - - - - - - - - - - - +-------------------------------+ | |Masking-key, if MASK set to 1 | +-------------------------------+-------------------------------+ | Masking-key (continued) | Payload Data | +-------------------------------- - - - - - - - - - - - - - - - + : Payload Data continued ... : + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + | Payload Data continued ... | +---------------------------------------------------------------+ RFC 6455, section 5.2 The browser API handles this for you
  • 14. Proxies and subprotocols ● Proxies – In-line proxies may be an issue ● ● – Using TLS avoids the issue and is good-practice anyway Configured proxies ● ● Masking helps avoid frame corruption, but sometimes the handshake fails Must support the CONNECT HTTP request Subprotocols – http://www.iana.org/assignments/websocket/websocket.xml
  • 15. Opensource projects ● Node.js – ● SIP Servers – ● JAIN-SIP-Javascript, JsSIP, QoffeeSIP, sipml5 XMPP Servers (and connection managers) – ● Asterisk, Kamailio, OverSIP, reSIPprocate SIP Clients – ● Many WebSocket libraries available ejabberd-websockets, node-xmpp-bosh, openfire-websockets XMPP Clients – JSJaC, Strophe
  • 16. Demo #2: Web Communicator ● A fully-featured unified communications client ● Makes use of WebSocket and WebRTC ● Multiple WebSocket connections for multiple protocols – ● ● MSRP (file-transfer), SIP (session signalling), and XMPP (messaging and presence) No need to create a new application for every target platform Browsers without WebRTC support can still use WebSocket for file-transfer, messaging, presence, and other data
  • 17. Demo #2: Web Communicator
  • 18. WebRTC There are a number of proprietary implementations that provide direct interactive rich communication using audio, video, collaboration, games, etc. between two peers' webbrowsers. These are not interoperable, as they require nonstandard extensions or plugins to work. There is a desire to standardize the basis for such communication so that interoperable communication can be established between any compatible browsers. Real-Time Communication in WEBBrowsers (rtcweb) 2013-03-13 charter http://tools.ietf.org/wg/rtcweb/
  • 19. WebRTC has a rich API ● Media Capture and Streams – – ● Audio, video, and screen-sharing http://www.w3.org/TR/mediacapture-streams/ MediaStream Recording – ● http://www.w3.org/TR/mediastream-recording/ WebRTC – Data can be exchanged too – http://www.w3.org/TR/webrtc/ Available (to varying degrees) in Chrome and Firefox stable
  • 20. The WebRTC APIs are not enough ● ● Google made a controversial (but very wise) decision not to specify how the signalling should work Signalling is required – To discover who to communicate with – To exchange information on what the communication should be (audio, data, video, and codecs) – Even the simplest, proprietary, RESTful
  • 22. Signalling options ● Open standards are usually best – – XMPP over WebSocket, http://tools.ietf.org/html/draft-moffitt-xmpp-over-websocket – ● SIP over WebSocket, http://tools.ietf.org/html/draft-ietf-sipcore-sip-websocket OpenPeer, http://openpeer.org/ The WebRTC API is easy but signalling is often hard – There are many open-source libraries that do the signalling – The library APIs vary in complexity to meet every need – Hosted infrastructure lets you add real-time communications to your website without having to build a network yourself
  • 23. Demo #3: Chrome Developer Tools ● Google Chrome provides a range of tools to help you create and debug applications ● You can add view code and add breakpoints ● You can modify code and view debug ● You can examine what is happening on the wire – ● The Network → WebSockets view can be particularly helpful – especially if using TLS ...
  • 24. Demo #3: Chrome Developer Tools
  • 25. Dealing with firewalls ● WebRTC is peer-to-peer technology ● Sometimes firewall and NAT devices get in the way ● ICE (Interactive Connectivity Establishment) is mandatory – – ● STUN (Session Traversal Utilities for NAT) helps in most cases TURN (Traversal Using Relays around NAT) helps when STUN doesn't If a firewall is specifically configured to block real-time communications your options are limited
  • 26. Applications of this technology ● Telecommunications – ● Distance learning – ● File-sharing, collaboration Gaming – ● Providing medical services out-of-hours and to remote locations Peer-to-peer applications – ● Virtual colleges and universities Telemedicine – ● Unified communications, corporate infrastructure, call centres Multi-player interactive (with and without servers) ...
  • 27. Browser support today http://caniuse.com/ IE FF Chrome Safari O iOS Safari O Mini Android Browser Blackberry Browser O Mobile Chrome for Android FF for Android WebSocket 10.0 6.0 14.0 6.0 12.1 6.0 - - 7.0 12.1 27.0 22.0 WebRTC - 17.0*** 21.0*** - -* - - - 10.0*** -* -** - * Partial support for GetUserMedia is in some old versions ** WebRTC is known to work in the latest version if you set a flag *** As WebRTC is still under development later browser versions will be more stable and have more features
  • 28. Desktop and mobile apps ● This technology isn't just for browsers ● Native WebRTC libraries are available – – ● Mobile: Android and iOS Desktop: Linux, OS X, and Windows Native WebSocket libraries are available – WebSockets are a sensible option for mobile app developers who want a safe way to exchange data with servers
  • 30. Crocodile WebRTC SDK and Network www.crocodilertc.net