A few words about 
MoscowJS, july 2014 Konstantin Burkalev, @KSDaemon
WAMP 
≠ 
Windows, Apache, 
MySQL, PHP
WAMP 
= 
Application level protocol, " 
implementing 2 patterns: 
• Publish/Subscribe (PubSub)" 
• Remote Procedure Calls ...
Basic components and definitions 
• Resource identifier 
• Transport 
• Serializer 
• Session 
• Realm - domain, namespace...
Architecture
Resource identifiers 
Required for: 
• Subscriptions 
• Procedures 
• Errors 
are URI-based 
• system.send.file 
• chat.me...
Serialization and data types 
Supported serializers: 
• JSON • MsgPack 
Supported data types: 
Required: Additional: 
• in...
Messages and payload 
• [HELLO, 
Realm|uri, 
Details|dict] 
" 
• [PUBLISH, 
Request|id, 
Options|dict, 
Topic|uri] 
• [PUB...
Transport 
• Based on messages 
• Messages are ordered 
• Bidirectional message flow 
• Websocket 
• Raw TCP 
• HTTP long-...
Transport and Session 
Client Router
Transport and Session 
Client Router 
HELLO
Transport and Session 
Client Router 
HELLO 
WELCOME
Transport and Session 
Client Router 
HELLO 
WELCOME 
ABORT
Transport and Session 
Client Router 
HELLO 
WELCOME 
ABORT 
GOODBYE
Transport and Session 
Client Router 
HELLO 
WELCOME 
ABORT 
GOODBYE 
GOODBYE
Transport and Session 
Client Router 
HELLO 
WELCOME 
ABORT 
GOODBYE 
GOODBYE 
GOODBYE
Transport and Session 
Client Router 
HELLO 
WELCOME 
ABORT 
GOODBYE 
GOODBYE 
GOODBYE 
GOODBYE
Publish / Subscribe 
Publisher Broker Subscriber
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED 
ERROR
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED 
ERROR 
PUBLISH
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED 
ERROR 
PUBLISH 
PUBLISHED
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED 
ERROR 
PUBLISH 
PUBLISHED 
ERROR
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED 
ERROR 
PUBLISH 
PUBLISHED 
ERROR 
EVENT
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED 
ERROR 
UNSUBSCRIBE 
PUBLISH 
PUBLISHED 
ERROR 
EV...
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED 
ERROR 
UNSUBSCRIBE 
UNSUBSCRIBED 
PUBLISH 
PUBLIS...
Publish / Subscribe 
Publisher Broker Subscriber 
SUBSCRIBE 
SUBSCRIBED 
ERROR 
UNSUBSCRIBE 
UNSUBSCRIBED 
ERROR 
PUBLISH ...
Remote Procedure Calls 
Caller Dealer Callee
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
CALL
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
CALL 
INVOCATION
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
CALL 
INVOCATION 
YIELD
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
CALL 
INVOCATION 
YIELD 
ERROR
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
CALL 
RESULT 
INVOCATION 
YIELD 
ERROR
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
CALL 
RESULT 
INVOCATION 
YIELD 
ERROR 
ERROR
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
UNREGISTER 
CALL 
RESULT 
INVOCATION 
YIELD 
ER...
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
UNREGISTER 
UNREGISTERED 
CALL 
RESULT 
INVOCAT...
Remote Procedure Calls 
Caller Dealer Callee 
REGISTER 
REGISTERED 
ERROR 
UNREGISTER 
UNREGISTERED 
ERROR 
CALL 
RESULT 
...
Profiles 
Set of features within each pattern 
(PubSub, RPC) 
• Basic profile 
• Advanced profile
Advanced profile 
• Session Management 
• Authentication 
• Heartbeat
Advanced profile 
• Publish / Subscribe 
• Black/white lists 
• Publisher identification 
• Pattern-based subscriptions 
•...
Advanced profile 
• Remote Procedure Calls 
• black/white lists 
• Caller identification 
• Pattern-based RPC registration...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Online consultant 
Browser 
Embedded 
app 
client 
Browser 
Embedded 
app 
client 
Browser 
Backoffice 
app...
Usage example 
Browser 
Browser 
Integration solution 
Server side infrastructure 
WAMP Router 
Mobile 
Desktop 
SUBSCRIBE...
Usage example 
WAMP as a platform for SOA solutions 
Consumer 1 Consumer 2 Consumer 3 Consumer 4 Consumer 5 
Provides RPC ...
Usage example 
WAMP as a platform for SOA solutions 
• Unified service bus 
• Asynchronous procedures execution 
• Standar...
Implementations 
• JavaScript! 
• Autobahn|JS (browser, node.js) 
• Wampy.js (browser) 
• Java! 
• Autobahn|Android (soon)...
Conclusion 
• Simple and open protocol 
• RPC + PubSub out of the box 
• Unified routing 
• Transport and serialization fo...
Useful links 
• http://wamp.ws! 
• Description 
• Specification 
• Implementations 
• https://groups.google.com/group/wamp...
That’s all folks!" 
Any questions 
?
Konstantin Burkalev 
Thank you! 
• Mail: kostik@ksdaemon.ru 
• Twitter: @KSDaemon 
• GitHub: KSDaemon 
• Blog: blog.ksdaem...
Prochain SlideShare
Chargement dans…5
×

A few words about WAMP

5 055 vues

Publié le

Presentation about WAMP (WebSocket Application Messaging Protocol), it's architecture, implementations and possible use cases.

Publié dans : Technologie
1 commentaire
9 j’aime
Statistiques
Remarques
Aucun téléchargement
Vues
Nombre de vues
5 055
Sur SlideShare
0
Issues des intégrations
0
Intégrations
63
Actions
Partages
0
Téléchargements
94
Commentaires
1
J’aime
9
Intégrations 0
Aucune incorporation

Aucune remarque pour cette diapositive

A few words about WAMP

  1. 1. A few words about MoscowJS, july 2014 Konstantin Burkalev, @KSDaemon
  2. 2. WAMP ≠ Windows, Apache, MySQL, PHP
  3. 3. WAMP = Application level protocol, " implementing 2 patterns: • Publish/Subscribe (PubSub)" • Remote Procedure Calls (RPC)
  4. 4. Basic components and definitions • Resource identifier • Transport • Serializer • Session • Realm - domain, namespace • Peer • Client • Router • Role
  5. 5. Architecture
  6. 6. Resource identifiers Required for: • Subscriptions • Procedures • Errors are URI-based • system.send.file • chat.message • users.admins.message • user.profile.updated
  7. 7. Serialization and data types Supported serializers: • JSON • MsgPack Supported data types: Required: Additional: • integer • string • bool • list (array) • dict any, depends on serializer
  8. 8. Messages and payload • [HELLO, Realm|uri, Details|dict] " • [PUBLISH, Request|id, Options|dict, Topic|uri] • [PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list] • [PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list, ArgumentsKw|dict] " • [CALL, Request|id, Options|dict, Procedure|uri] • [CALL, Request|id, Options|dict, Procedure|uri, Arguments|list] • [CALL, Request|id, Options|dict, Procedure|uri, Arguments|list, ArgumentsKw|dict] " • [RESULT, CALL.Request|id, Details|dict] • [RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list] • [RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list, YIELD.ArgumentsKw|dict] Payload may be supplied as: • Array | List • Hash-table | Dictionary
  9. 9. Transport • Based on messages • Messages are ordered • Bidirectional message flow • Websocket • Raw TCP • HTTP long-polling (under dev) • Unix sockets
  10. 10. Transport and Session Client Router
  11. 11. Transport and Session Client Router HELLO
  12. 12. Transport and Session Client Router HELLO WELCOME
  13. 13. Transport and Session Client Router HELLO WELCOME ABORT
  14. 14. Transport and Session Client Router HELLO WELCOME ABORT GOODBYE
  15. 15. Transport and Session Client Router HELLO WELCOME ABORT GOODBYE GOODBYE
  16. 16. Transport and Session Client Router HELLO WELCOME ABORT GOODBYE GOODBYE GOODBYE
  17. 17. Transport and Session Client Router HELLO WELCOME ABORT GOODBYE GOODBYE GOODBYE GOODBYE
  18. 18. Publish / Subscribe Publisher Broker Subscriber
  19. 19. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE
  20. 20. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED
  21. 21. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED ERROR
  22. 22. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED ERROR PUBLISH
  23. 23. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED ERROR PUBLISH PUBLISHED
  24. 24. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED ERROR PUBLISH PUBLISHED ERROR
  25. 25. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED ERROR PUBLISH PUBLISHED ERROR EVENT
  26. 26. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED ERROR UNSUBSCRIBE PUBLISH PUBLISHED ERROR EVENT
  27. 27. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED ERROR UNSUBSCRIBE UNSUBSCRIBED PUBLISH PUBLISHED ERROR EVENT
  28. 28. Publish / Subscribe Publisher Broker Subscriber SUBSCRIBE SUBSCRIBED ERROR UNSUBSCRIBE UNSUBSCRIBED ERROR PUBLISH PUBLISHED ERROR EVENT
  29. 29. Remote Procedure Calls Caller Dealer Callee
  30. 30. Remote Procedure Calls Caller Dealer Callee REGISTER
  31. 31. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED
  32. 32. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR
  33. 33. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR CALL
  34. 34. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR CALL INVOCATION
  35. 35. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR CALL INVOCATION YIELD
  36. 36. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR CALL INVOCATION YIELD ERROR
  37. 37. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR CALL RESULT INVOCATION YIELD ERROR
  38. 38. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR CALL RESULT INVOCATION YIELD ERROR ERROR
  39. 39. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR UNREGISTER CALL RESULT INVOCATION YIELD ERROR ERROR
  40. 40. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR UNREGISTER UNREGISTERED CALL RESULT INVOCATION YIELD ERROR ERROR
  41. 41. Remote Procedure Calls Caller Dealer Callee REGISTER REGISTERED ERROR UNREGISTER UNREGISTERED ERROR CALL RESULT INVOCATION YIELD ERROR ERROR
  42. 42. Profiles Set of features within each pattern (PubSub, RPC) • Basic profile • Advanced profile
  43. 43. Advanced profile • Session Management • Authentication • Heartbeat
  44. 44. Advanced profile • Publish / Subscribe • Black/white lists • Publisher identification • Pattern-based subscriptions • Meta events • Subscriber list • Events list
  45. 45. Advanced profile • Remote Procedure Calls • black/white lists • Caller identification • Pattern-based RPC registration • Canceling calls • Progressive calls
  46. 46. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client WAMP Router (realm 2)
  47. 47. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client subscribe to ‘ready.for.chat’ subscribe to ‘ready.for.chat’ WAMP Router (realm 2)
  48. 48. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client WAMP Router (realm 2) subscribe to ‘chat.taken’ subscribe to ‘chat.taken’
  49. 49. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client subscribe to ‘user.chat.id1235’ WAMP Router (realm 2)
  50. 50. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client publish event to ‘ready.for.chat’ WAMP Router (realm 2)
  51. 51. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client receive event in ‘ready.for.chat’ receive event in ‘ready.for.chat’ WAMP Router (realm 2)
  52. 52. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client publish event to ‘chat.taken’ WAMP Router (realm 2)
  53. 53. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client receive event in ‘chat.taken’ WAMP Router (realm 2)
  54. 54. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client publish event to ‘user.chat.id1235’ WAMP Router (realm 2)
  55. 55. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client receive event in ‘user.chat.id1235’ WAMP Router (realm 2)
  56. 56. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client subscribe to ‘user.chat.id2425’ WAMP Router (realm 2)
  57. 57. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client publish event to ‘ready.for.chat’ WAMP Router (realm 2)
  58. 58. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client receive event in ‘ready.for.chat’ receive event in ‘ready.for.chat’ WAMP Router (realm 2)
  59. 59. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client publish event to ‘chat.taken’ WAMP Router (realm 2)
  60. 60. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client receive event in ‘chat.taken’ WAMP Router (realm 2)
  61. 61. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client publish event to ‘user.chat.id2425’ WAMP Router (realm 2)
  62. 62. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client receive event in ‘user.chat.id2425’ WAMP Router (realm 2)
  63. 63. Usage example Online consultant Browser Embedded app client Browser Embedded app client Browser Backoffice app client Browser Backoffice app client WAMP Router (realm 1) Browser Embedded app client Browser Embedded app client WAMP Router (realm 2)
  64. 64. Usage example Browser Browser Integration solution Server side infrastructure WAMP Router Mobile Desktop SUBSCRIBE to TOPICs REGISTER RPC REGISTER RPC REGISTER RPC SUBSCRIBE to TOPICs Internal service 1 Internal service 2 Internal service 3 Frontoffice app client Frontoffice app client CRUD Nginx / HAProxy CRUD CRUD Backoffice app client SUBSCRIBE to TOPICs PUBLISH Event PUBLISH Event CALL RPCs Nginx / HAProxy Backoffice app client DB CRUD CRUD Backoffice app serverside Frontoffice app serverside
  65. 65. Usage example WAMP as a platform for SOA solutions Consumer 1 Consumer 2 Consumer 3 Consumer 4 Consumer 5 Provides RPC Call RPC Publish events Subscribe to topics Call RPC Provides RPC Publish events Service Provider 1 Service Provider 2 Service Provider 3 Service Provider 4 Service Provider 5 Publish events WAMP Router (realm 1, realm 2, realm 3, ....) Subscribe to topics Publish events
  66. 66. Usage example WAMP as a platform for SOA solutions • Unified service bus • Asynchronous procedures execution • Standardization of interaction interfaces • Minimal overhead • Flexible infrastructure • Isolation and loose coupling of services • Easy to connect new services
  67. 67. Implementations • JavaScript! • Autobahn|JS (browser, node.js) • Wampy.js (browser) • Java! • Autobahn|Android (soon) • .NET! • WampSharp (under dev) • PHP! • Thurway Clients • Python! • Autobahn|Python • C++! • Autobahn|Cpp • Erlang! • Erwa • Objective-C! • MDWamp • Lua (under dev) Routers • Python! • Autobahn|Python • Crossbar.io • Erlang! • Erwa • PHP! • Thurway • Lua! • Wiola
  68. 68. Conclusion • Simple and open protocol • RPC + PubSub out of the box • Unified routing • Transport and serialization for every taste • Minimal overhead • Native use in web applications • Allows you to build distributed applications with loosely coupled components • Many implementations in different languages • Open source & community
  69. 69. Useful links • http://wamp.ws! • Description • Specification • Implementations • https://groups.google.com/group/wampws • http://autobahn.ws • https://github.com/crossbario/crossbar/wiki • Crossbar.io • Client examples in different languages
  70. 70. That’s all folks!" Any questions ?
  71. 71. Konstantin Burkalev Thank you! • Mail: kostik@ksdaemon.ru • Twitter: @KSDaemon • GitHub: KSDaemon • Blog: blog.ksdaemon.ru

×