Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
The missing signaling layer for WebRTC
kegan@matrix.org
http://www.matrix.org
WebRTC doesn’t specify a
signaling protocol.
Signaling is essential to any
interactive application.
2
Signaling needs to work
across varied devices.
Users are demanding more
(IM, Push notifications, call
logs, discovery)
3
What’s wrong with SIP?
4
• It cargo-cults the PSTN
• It’s (almost) all 1:1 communication
• Chat, file transfer etc is clun...
A new way of thinking is
required.
5
Wouldn’t it be nice to be able
to speak to whoever you
wanted no matter which app
they used?
6
7
Users are locked into
proprietary communication
apps.
They have no control over
their data or their privacy.
I want to use the best client
for me, not be forced into
specific services chosen by
my contacts.
Email gets it right.
Enter Matrix
10
What is Matrix?
An open standard for
decentralized messaging.
11
Matrix is:
• Non-profit Open Source Project
• Open Standard HTTP APIs:
– Client <-> Server
– Server <-> Server
– Applicati...
What can it be used for?
Instant Messaging, VoIP, IoT,
“bridging” between apps
13
Common WebRTC signaling
(RFC 7118) is SIP over
WebSockets.
Matrix is JSON over
WebSockets/HTTP.
14
Matrix provides:
• Open, decentralized, eventually-consistent data store
– Instant Messages
– VoIP (call logs, duration, t...
Matrix Architecture
Clients
Home
Servers
Identity
Servers
Application
Servers
Functional Responsibility
• Clients: Talks simple HTTP APIs to homeservers to
push and pull messages and metadata. May be ...
Matrix Concepts
@
!
{	}
Users
Message Events
Rooms
State Events
[	]
A B
Room	NameMember	A
Member	B
Invite	C
Permissions
{	...
Matrix Concepts
@
!
{	}
Users
Message Events
Rooms
State Events
[	]
A B
Room	NameMember	A
Member	B
Invite	C
Permissions
{	...
Matrix Concepts
@
!
{	}
Users
Message Events
Rooms
State Events
[	]
A B
Room	NameMember	A
Member	B
Invite	C
Permissions
{	...
Matrix Concepts
@
!
{	}
Users
Message Events
Rooms
State Events
[	]
A B
Room	NameMember	A
Member	B
Invite	C
Permissions
{	...
Matrix Concepts
@
!
{	}
Users
Message Events
Rooms
State Events
[	]
A B
Room	NameMember	A
Member	B
Invite	C
Permissions
{	...
Matrix Concepts
@
!
{	}
Users
Message Events
Rooms
State Events
[	]
A B
Room	NameMember	A
Member	B
Invite	C
Permissions
{	...
Matrix Concepts
@
!
{	}
Users
Message Events
Rooms
State Events
[	]
A B
Room	NameMember	A
Member	B
Invite	C
Permissions
{	...
Matrix Concepts
@
!
{	}
Users
Message Events
Rooms
State Events
[	]
A B
New	Room	NameMember	A
Member	B
Invite	C
Permission...
What things have been built
using Matrix?
26
Demo time!
http://matrix.org/blog/try-matrix-now
27
The Matrix Ecosystem
The	Matrix	Specification	(Client/Server	API)
client-sideserver-side
Other	Servers	and	
Services
Synap...
How do I use it?
The baseline protocol is JSON
over HTTP. Any device which
can make HTTP requests can
use Matrix.
29
The client-server API
To send a message:
curl -XPOST -d '{"msgtype":"m.text", "body":"hello"}'
"https://alice.com:8448/_ma...
The client-server API
To set up a WebRTC call:
curl -XPOST –d '{¥
"version": 0, ¥
"call_id": "12345”, ¥
"offer": {
"type" ...
Basic 1:1 VoIP Matrix Signaling
Caller Callee
m.call.invite ----------->
m.call.candidate -------->
[more candidates event...
The client-server API
To persist some MIDI:
curl -XPOST –d '{¥
"note": "71",¥
"velocity": 68,¥
"state": "on",¥
"channel": ...
The server-server API
curl –XPOST –H ‘Authorization: X-Matrix origin=matrix.org,key=”898be4…”,sig=“j7JXfIcPFDWl1pdJz…”’ –d...
Application Services (AS)
• Extensible custom application logic
• They have privileged access to the server (granted by th...
A trivial application service
import json, requests
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.r...
Matrix Bridging with ASes
Existing App
Application
Service
3rd party
Server
3rd party
Clients
Matrix to PSTN
matrix-
appservice-verto
FreeSWITCH
PSTN
Numbers
Matrix to IRC
matrix-
appservice-irc
ircd
(e.g. Freenode)
IRC
clients
Matrix to
matrix-
appservice-slack
slack.com
Slack
clients
to IRC
IRC
clients
Slack
clients
Matrix Bridge Stack
42
matrix-
appservice-
irc
matrix-appservice-bridge
matrix-appservice-node
matrix-js-sdk
Node	JS
matri...
We need your help!
• We need people to try running their own
servers and join the federation.
• We need people to run gateways to their
exist...
45
The end goal:
Thank you!
kegan@matrix.org
http://matrix.org
@matrixdotorg
46
Upcoming SlideShare
Loading in …5
×

The missing signalling layer for WebRTC

583 views

Published on

WebRTC Conference Japan 2016 発表資料
2016/2/16 Matrix.org Kegan Dougalさん
Slides of Mr. Kegan Dougal from Matrix.org, at WebRTC Conference Japan 2016

Published in: Technology
  • Be the first to comment

  • Be the first to like this

The missing signalling layer for WebRTC

  1. 1. The missing signaling layer for WebRTC kegan@matrix.org http://www.matrix.org
  2. 2. WebRTC doesn’t specify a signaling protocol. Signaling is essential to any interactive application. 2
  3. 3. Signaling needs to work across varied devices. Users are demanding more (IM, Push notifications, call logs, discovery) 3
  4. 4. What’s wrong with SIP? 4 • It cargo-cults the PSTN • It’s (almost) all 1:1 communication • Chat, file transfer etc is clunky • No synced conversation history • etc…
  5. 5. A new way of thinking is required. 5
  6. 6. Wouldn’t it be nice to be able to speak to whoever you wanted no matter which app they used? 6
  7. 7. 7
  8. 8. Users are locked into proprietary communication apps. They have no control over their data or their privacy.
  9. 9. I want to use the best client for me, not be forced into specific services chosen by my contacts. Email gets it right.
  10. 10. Enter Matrix 10
  11. 11. What is Matrix? An open standard for decentralized messaging. 11
  12. 12. Matrix is: • Non-profit Open Source Project • Open Standard HTTP APIs: – Client <-> Server – Server <-> Server – Application Services <-> Server • Apache-Licensed Open Source Reference Implementations – Server (Python/Twisted) – Client SDKs (iOS, Android, JS, Angular, Python, Perl) – Clients (Web, iOS, Android) – Application Services (IRC, SIP, XMPP, Lync bridges) • A whole ecosystem of 3rd party servers, clients & services 12
  13. 13. What can it be used for? Instant Messaging, VoIP, IoT, “bridging” between apps 13
  14. 14. Common WebRTC signaling (RFC 7118) is SIP over WebSockets. Matrix is JSON over WebSockets/HTTP. 14
  15. 15. Matrix provides: • Open, decentralized, eventually-consistent data store – Instant Messages – VoIP (call logs, duration, timestamps) – IoT data • Publish-subscribe (PubSub) HTTP/WS API • “Push Gateways” to reach mobile devices (GCM/APNS) • Server-to-Server Federation: no single point of failure. 15
  16. 16. Matrix Architecture Clients Home Servers Identity Servers Application Servers
  17. 17. Functional Responsibility • Clients: Talks simple HTTP APIs to homeservers to push and pull messages and metadata. May be as thin or thick a client as desired. • Homeservers: Stores all the data for a user - the history of the rooms in which they participate; their public profile data. • Application Services: Optional; delivers application layer logic on top of Matrix (Gateways, Conferencing, Archiving, Search etc). Can actively intercept messages if required. • Identity Servers: Trusted clique of servers (think DNS root servers): maps 3rd party IDs to matrix IDs. 17
  18. 18. Matrix Concepts @ ! { } Users Message Events Rooms State Events [ ] A B Room NameMember A Member B Invite C Permissions { (t,s) => content } Message Message Message Message Message Member List
  19. 19. Matrix Concepts @ ! { } Users Message Events Rooms State Events [ ] A B Room NameMember A Member B Invite C Permissions { (t,s) => content } Message Message Message Message Message Member List Message Invite D
  20. 20. Matrix Concepts @ ! { } Users Message Events Rooms State Events [ ] A B Room NameMember A Member B Invite C Permissions { (t,s) => content } Message Message Message Message Message Member List Message Invite D
  21. 21. Matrix Concepts @ ! { } Users Message Events Rooms State Events [ ] A B Room NameMember A Member B Invite C Permissions { (t,s) => content } Message Message Message Message Message Member List Message Invite D D
  22. 22. Matrix Concepts @ ! { } Users Message Events Rooms State Events [ ] A B Room NameMember A Member B Invite C Permissions { (t,s) => content } Message Message Message Message Message Member List Message Invite D DMember D
  23. 23. Matrix Concepts @ ! { } Users Message Events Rooms State Events [ ] A B Room NameMember A Member B Invite C Permissions { (t,s) => content } Message Message Message Message Message Member List Message Member D D
  24. 24. Matrix Concepts @ ! { } Users Message Events Rooms State Events [ ] A B Room NameMember A Member B Invite C Permissions { (t,s) => content } Message Message Message Message Message Member List Message Member D D New Room Name
  25. 25. Matrix Concepts @ ! { } Users Message Events Rooms State Events [ ] A B New Room NameMember A Member B Invite C Permissions { (t,s) => content } Message Message Message Message Message Member List Message Member D D
  26. 26. What things have been built using Matrix? 26
  27. 27. Demo time! http://matrix.org/blog/try-matrix-now 27
  28. 28. The Matrix Ecosystem The Matrix Specification (Client/Server API) client-sideserver-side Other Servers and Services Synapse (Reference Matrix Server) Matrix Application Services Other Clients Matrix iOS Console MatrixKit (iOS) matrix-ios-sdk Matrix Web Console matrix- angular- sdk matrix-js-sdk Android Console matrix-android- sdk matrix- react- sdk
  29. 29. How do I use it? The baseline protocol is JSON over HTTP. Any device which can make HTTP requests can use Matrix. 29
  30. 30. The client-server API To send a message: curl -XPOST -d '{"msgtype":"m.text", "body":"hello"}' "https://alice.com:8448/_matrix/client/api/v1/rooms/ROOM_ID/send/m.room.messa ge?access_token=ACCESS_TOKEN" { "event_id": "YUwRidLecu" } 30
  31. 31. The client-server API To set up a WebRTC call: curl -XPOST –d '{¥ "version": 0, ¥ "call_id": "12345”, ¥ "offer": { "type" : "offer”, "sdp" : "v=0¥r¥no=- 658458 2 IN IP4 127.0.0.1…" } }' "https://alice.com:8448/_matrix/client/api/v1/rooms/ROOM_ID/send/m.call.invit e?access_token=ACCESS_TOKEN" { "event_id": "ZruiCZBu” } 31
  32. 32. Basic 1:1 VoIP Matrix Signaling Caller Callee m.call.invite -----------> m.call.candidate --------> [more candidates events] User answers call <------ m.call.answer [media flows] <------ m.call.hangup 32
  33. 33. The client-server API To persist some MIDI: curl -XPOST –d '{¥ "note": "71",¥ "velocity": 68,¥ "state": "on",¥ "channel": 1,¥ "midi_ts": 374023441¥ }' "https://alice.com:8448/_matrix/client/api/v1/rooms/ROOM_ID/send/org.matrix.m idi?access_token=ACCESS_TOKEN" { "event_id": “ORzcZn2” } 33
  34. 34. The server-server API curl –XPOST –H ‘Authorization: X-Matrix origin=matrix.org,key=”898be4…”,sig=“j7JXfIcPFDWl1pdJz…”’ –d ‘{ "ts": 1413414391521, "origin": "matrix.org", "destination": "alice.com", "prev_ids": ["e1da392e61898be4d2009b9fecce5325"], "pdus": [{ "age": 314, "content": { "body": "hello world", "msgtype": "m.text" }, "context": "!fkILCTRBTHhftNYgkP:matrix.org", "depth": 26, "hashes": { "sha256": "MqVORjmjauxBDBzSyN2+Yu+KJxw0oxrrJyuPW8NpELs" }, "is_state": false, "origin": "matrix.org", "pdu_id": "rKQFuZQawa", "pdu_type": "m.room.message", "prev_pdus": [ ["PaBNREEuZj", "matrix.org"] ], "signatures": { "matrix.org": { "ed25519:auto": "jZXTwAH/7EZbjHFhIFg8Xj6HGoSI+j7JXfIcPFDWl1pdJz+JJPMHTDIZRha75oJ7lg7UM+CnhNAayHWZsUY3Ag" } }, "origin_server_ts": 1413414391521, "user_id": "@matthew:matrix.org" }] }’ https://alice.com:8448/_matrix/federation/v1/send/916d630ea616342b42e98a3be0b74113 34
  35. 35. Application Services (AS) • Extensible custom application logic • They have privileged access to the server (granted by the admin). • They can subscribe to wide ranges of server traffic (e.g. events which match a range of rooms, or a range of users) • They can masquerade as 'virtual users'. • They can lazy-create 'virtual rooms' • They can receive traffic by push. 35
  36. 36. A trivial application service import json, requests from flask import Flask, jsonify, request app = Flask(__name__) @app.route("/transactions/<transaction>", methods=["PUT"]) def on_receive_events(transaction): events = request.get_json()["events"] for event in events: print "User: %s Room: %s" % (event["user_id"], event["room_id"]) print "Event Type: %s" % event["type"] print "Content: %s" % event["content"] return jsonify({}) if __name__ == "__main__": app.run() 36
  37. 37. Matrix Bridging with ASes Existing App Application Service 3rd party Server 3rd party Clients
  38. 38. Matrix to PSTN matrix- appservice-verto FreeSWITCH PSTN Numbers
  39. 39. Matrix to IRC matrix- appservice-irc ircd (e.g. Freenode) IRC clients
  40. 40. Matrix to matrix- appservice-slack slack.com Slack clients
  41. 41. to IRC IRC clients Slack clients
  42. 42. Matrix Bridge Stack 42 matrix- appservice- irc matrix-appservice-bridge matrix-appservice-node matrix-js-sdk Node JS matrix- appservice- slack matrix- appservice- purple …
  43. 43. We need your help!
  44. 44. • We need people to try running their own servers and join the federation. • We need people to run gateways to their existing services • We need feedback on the APIs. • Consider native Matrix support for new apps • Follow @matrixdotorg and spread the word! 44
  45. 45. 45 The end goal:
  46. 46. Thank you! kegan@matrix.org http://matrix.org @matrixdotorg 46

×