Tipping the Webscale. with XMPP & WebSockets

Similar documents
Massive IM Scalability using WebSockets Michał Ślaski

Category: Standards Track October Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence

XMPP Illustrated: Getting to Know XMPP

Corso di Applicazioni Telematiche

MongooseIM - Messaging that Scales

A platform to build real-time social applications. Daniel Appelquist props to Laurent Eschenauer, Alard Weisscher and Diana Cheng

Instant Messaging Compliance for the IM and Presence Service, Release 12.0(1)

Part I XMPP Protocol and Architecture COPYRIGHTED MATERIAL. Chapter 1: Getting to Know XMPP. Chapter 2: Designing XMPP Applications

XEP-0133: Service Administration

Changes to UCR 2008, Change 2, made by Change 3 for Section 5.7, Near-Real-Time, Text-Based Messaging Products

Department of Defense Unified Capabilities (UC) Extensible Messaging and Presence Protocol (XMPP) 2013 (UC XMPP 2013) Errata-1

SECTION CORRECTION EFFECTIVE DATE

XMPP/Jabber introducing the lingua franca of instant messaging

DEVELOPER GUIDE FOR CISCO UNIFIED CM IM AND PRESENCE 10.5(2)

Overview of this Integration

XEP-0146: Remote Controlling Clients

EUC 2015 MongooseIM The Right Tool for Scalable Messaging. Michał Piotrowski

XEP-0280: Message Carbons

XEP-0357: Push Notifications

Security Guide Zoom Video Communications Inc.

Deploying OAuth with Cisco Collaboration Solution Release 12.0

Interdomain Federation Guide for IM and Presence Service on Cisco Unified Communications Manager, Release 11.5(1)SU2

XEP-0033: Extended Stanza Addressing

XEP-0060: Publish-Subscribe

Cisco Jabber Deployment for Multiple CUCM and IMP clusters using single Expressway-E and C.

Ontology Summit 2015 Internet of Things

IM and Presence Service Configuration for XMPP Federation

Kaazing. Connect. Everything. WebSocket The Web Communication Revolution

Cisco Jabber Reference Information

Interdomain Federation for IM and Presence Service on Cisco Unified Communications Manager, Release 10.5(1)

Interdomain Federation for the IM and Presence Service, Release 10.x

Partitioned Intradomain Federation for IM and Presence Service on Cisco Unified Communications Manager, Release 11.5(1)SU2

XEP-0333: Chat Markers

XEP-0290: Encapsulated Digital Signatures in XMPP

Build the realtime web with XMPP and Wave

XEP-0206: XMPP Over BOSH

Request for Comments: 5437 Category: Standards Track Isode Limited January 2009

Expires: October 11, 2004 April 12, Extensible Messaging and Presence Protocol (XMPP): Core draft-ietf-xmpp-core-23. Status of this Memo

On the Creation & Discovery of Topics in Distributed Publish/Subscribe systems

Internet Engineering Task Force (IETF) Request for Comments: 6120 Obsoletes: 3920 March 2011 Category: Standards Track ISSN:

XEP-0363: HTTP File Upload

Tigase Push Component

Capability Advertisement Messages

Custom Embedded Tabs, on page 1 Configure Cisco Jabber for Android on Chromebook, on page 8 Cisco Jabber Mobile App Promotion, on page 9

Configuration Tab. Cisco WebEx Messenger Administration Guide 1

XEP-0412: XMPP Compliance Suites 2019

An Online Platform for Real-Time Sensor Data Collection, Visualization, and Sharing

Cisco Unified Communications XMPP Federation

XEP-0135: File Sharing

Simple Jabber - Divide And Conquer XMPP

XEP-0140: Shared Groups

XCP Controller Help. Product Version 4.0 Document Version A GA September 30, 2004

XEP-0114: Jabber Component Protocol

Polling Sucks. So what should we do instead?

Configuration and Administration of IM and Presence Service on Cisco Unified Communications Manager, Release 9.1(1)

Availability and Instant Messaging on IM and Presence Service Configuration

EXTENDING OBJECT-ORIENTED NETWORK PROTOCOLS VIA ALTERNATIVE TRANSPORTATION BINDINGS (WEB SERVICES OVER XMPP) Mihail D. Irintchev

Cisco Plug and Play Feature Guide Cisco Services. Cisco Plug and Play Feature Guide Cisco and/or its affiliates.

Security and Certificates

Configure Centralized Deployment

Set Up Voic on Cisco Unified Communications Manager

Oracle Communications Instant Messaging Server

Cisco Jabber IM for iphone

XEP-0313: Message Archive Management

COMET, HTML5 WEBSOCKETS OVERVIEW OF WEB BASED SERVER PUSH TECHNOLOGIES. Comet HTML5 WebSockets. Peter R. Egli INDIGOO.COM. indigoo.com. 1/18 Rev. 2.

SAML-Based SSO Solution

Release Notes for Cisco Jabber for Mac 11.9

Versioned APIs with Phoenix. Elvio Vicosa

XEP-0136: Message Archiving

Configure Cisco Jabber

Platform. Custom Embedded Tabs. Custom Embedded Tab Definitions. Custom Embedded Tabs, page 1

Configuration and Administration of IM and Presence Service on Cisco Unified Communications Manager, Release 11.5(1)

Securing the Life Cycle of Things in the Internet of Things using Thing Registries

Chat Setup and Management

This is a sample chapter of WebRTC: APIs and RTCWEB Protocols of the HTML5 Real-Time Web by Alan B. Johnston and Daniel C. Burnett.

SAML-Based SSO Solution

Taking Off with /

SIMPLE (SIP for Instant Messaging and Presence Leveraging Extensions Used by CM-IMP. XMPP (extensible Messaging and Presence Protocol) Used by CM-IMP

Introduction to the Application Layer. Computer Networks Term B14

Known Issues, Limitations, and Important Notes

IP Network Enabler. Feature Description. Relationships to Other Features

XEP-0045: Multi-User Chat

IERG 4080 Building Scalable Internet-based Services

Challenges. Distribution. Discovery. Security. Usability. Governance. Unreliable messaging. Physical objects. Dealing with places.

October 4, 2000 Expires in six months. SMTP Service Extension for Secure SMTP over TLS. Status of this Memo

XEP-0042: Jabber OOB Broadcast Service (JOBS)

Codewords: A Massively Multiplayer Board Game built with Angular

Cisco Webex Messenger

Cisco Expressway Authenticating Accounts Using LDAP

IOTIVITY INTRODUCTION

Designing Workspace of the Future for the Mobile Worker

Software Requirement Specification

AMQP and Beyond. Messaging by Extending RabbitMQ. Tony Garnock-Jones

XEP-0129: WebDAV File Transfers

Kestrel: Job Distribution and Scheduling using XMPP

Push Notifications (On-Premises Deployments)

XEP-0065: SOCKS5 Bytestreams

Frequently Asked Questions

Tigase MUC Component

Oracle Communications Instant Messaging Server. New Features. New Supported Standards. External Service Discovery. Release Notes Release 10.0.

Transcription:

Tipping the Webscale with XMPP & WebSockets

Sonny Scroggin email/xmpp: sonny@scrogg.in + github/twitter: @scrogson

Nashville, TN

openstack hosted private cloud // hybrid cloud bluebox.net

WHAT WE'LL COVER INTRODUCTION TO THE XMPP PROTOCOL SERVERS CLIENTS COMPONENTS HOW TO APPLY

EXTENSIBLE MESSAGING & PRESENCE PROTOCOL

CORE SERVICES Channel Encryption Authentication Presence Roster Messaging (one-to-one, multi-party) Service Discovery Notifications (Publish/Subscribe) Capabilities Advertisement Data Forms Peer-to-Peer Media Sessions

WHY XMPP? Why XMPP? Open - free, public, and easy to understand Standard - RFC 6120 / 6121 / 6122 Proven - first developed in 1998 and is very stable Decentralized - similar to email, run your own server Secure - SASL and TLS built-in Extensible - build on top of the core protocols

WHO USES IT? Apple - imessage, Push Notifications, Bonjour Google - GoogleTalk, Push Notifications Cisco - Webex Facebook - chat WhatsApp - started with ejabberd Chesspark - online chess game

ROUTING / ADDRESSING

ROUTING / ADDRESSING JID (Jabber ID) - addressing similar to email Bare - <user>@<server> Full - <user>@<server>/<resource> Resource - allows multiple sessions per user Automatically generated by the server if not specified Messages can be addressed to either the bare JID or full JID Messages to the bare JID route to the full JID with the highest priority

BASIC CONNECTION LIFECYCLE

BASIC CONNECTION LIFECYCLE Client initiates a TCP connection to the server Sends stream header Negotiates stream features and authentication mechanisms The client binds to a resource The client sends presence to the server The client requests its roster The client sends and receives messages to/from others The client ends the session and closes the connection

COMMUNICATION PRIMATIVES

COMMUNICATION PRIMATIVES XML Stanzas Fragments of XML sent over an XML stream <message/> <presence/> <iq/>

COMMUNICATION PRIMATIVES Common Attributes to: specifies the JID of the intended recipient from: specifies the JID of the sender type: specifies the purpose or context of the message xml:lang: specifies the default language of any such human-readable XML character data id: used by the originating entity to track any response or error stanza that it might receive in relation to the generated stanza from another entity

STANZAS: MESSAGE The <message/> stanza is a "push" mechanism. One entity pushes information to another entity, similar to the communications that occur in a system such as email. The payload in the case of instant messaging is a <body/> element, but it can also include any other custom elements to extend the protocol. <message to="romeo@im.montague.lit" id="sa7f8df" type="chat" xml:lang="en"> <body>where art thou, Romeo?</body> </message> NOTE: Juliet's server will add the "from" attribute when routing the message.

STANZAS: PRESENCE The <presence/> stanza is a "broadcast" or "publish/ subscribe" mechanism. Multiple entities receive information (in this case, network availability information) about an entity to which they have subscribed. Sets and shows the availability of the entity that is connected. Announce availability on the server <presence/>

STANZAS: PRESENCE Announce you're away <presence> <show>away</show> </presence> Do not disturb <presence> <show>dnd</show> <status>working hardcore...</status> </presence> Going offline <presence type="unavailable"/>

STANZAS: PRESENCE Subscriptions Juliet requests a subscription to Romeo's presence <presence to="romeo@im.montague.lit" type="subscribe"/> Romeo gladly excepts <presence to="juliet@im.capulet.lit" type="subscribed"/>

STANZAS: IQ The <iq/> stanza is a "request/response" mechanism, similar in some ways to HTTP. Enables an entity to make a request of, and receive a response from, the server or another entity. Request type is either "get" or "set". Response type is either "result" or "error". Service discovery Juliet requests Romeo's vcard <iq to="romeo@im.montague.lit" type="get" id="s8f7"> <vcard xmlns="vcard-temp"/> </iq>

STANZAS: IQ Romeo's server responds <iq to="juliet@im.capulet.lit/balcony" from="romeo@im.montague.lit" type="result" id="s8f7"> <vcard xmlns="vcard-temp"> <EMAIL> <USERID>romeo@montague.lit</USERID> </EMAIL> <FN>Romeo Montague</FN> </vcard> </iq>

STANZAS: IQ Roster request <iq to="im.capulet.lit" type="get" id="s8f7"> <query xmlns="jabber:iq:roster"/> </iq> Server response <iq to="juliet@im.capulet.lit/balcony" type="result" id="s8f7" from="im.capulet.lit"> <query xmlns="jabber:iq:roster"> <item jid="romeo@im.montague.lit" name="romeo Montague" subscription="both"> <group>lover</group> </item> </query> </iq>

SERVICE DISCOVERY

SERVICE DISCOVERY Query clients or servers about features/capabilities Enables you to find out which features are supported by another entity, as well as any additional entities that are associated with it (e.g., rooms hosted at a chat room service). disco#info query <iq to="juliet@im.capulet.lit/balcony" type="get" id="s8f7"> <query xmlns="http://jabber.org/protocol/disco#info"/> </iq>

SERVICE DISCOVERY disco#info response <iq from='juliet@im.capulet.lit/balcony' to='romeo@im.montague.lit/library' type='result' id='a2a3'> <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='client' type='pc' name='adium'/> <feature var='http://jabber.org/protocol/caps'/> <feature var='http://jabber.org/protocol/chatstates'/> <feature var='http://jabber.org/protocol/muc'/>... <feature var='http://jabber.org/protocol/muc#user'/> <feature var='http://jabber.org/protocol/xhtml-im'/> <feature var='http://jabber.org/protocol/commands'/> </query> </iq>

SERVICE DISCOVERY disco#items query <iq to="im.capulet.lit" type="get" id="s8f7"> <query xmlns="http://jabber.org/protocol/disco#items"/> </iq> disco#items response <iq from='im.capulet.lit' to='juliet@im.capulet.lit/balcony' id='1396' type='result'> <query xmlns='http://jabber.org/protocol/disco#items'> <item jid='conference.im.capulet.lit'/> <item jid='pubsub.im.capulet.lit'/> <item jid='vjud.im.capulet.lit'/> <item jid='im.capulet.lit' node='announce' name='announcements'/> <item jid='im.capulet.lit' name='configuration' node='config'/> <item jid='im.capulet.lit' name='user Management' node='user'/> <item jid='im.capulet.lit' name='online Users' node='online users'/> <item jid='im.capulet.lit' name='all Users' node='all users'/> </query> </iq>

SERVERS

SERVERS ejabberd https://github.com/processone/ejabberd The World's Most Popular XMPP Server Application Alexey Shchepin started ejabberd in November 2002 Written in Erlang Version 1.0 in December 2005 Supports most popular XMPP services Extremely flexible (gen_mod, ejabberd_hooks)

SERVERS MongooseIM https://github.com/esl/mongooseim Erlang Solutions forked ejabberd at version 2.1.8 OTP compliant project structure Improved the build process Removed obsolete/rarely used modules to reduce maintenance burden Reduction of runtime memory consumption Test coverage of the system according to corresponding RFCs and XEPs. MongooseIM provides high availability, ease of deployment, development, and reliability in production. It's aimed at large, complex enterprise level deployments where real-time communication is critical for business success.

CLIENTS

CLIENTS Stanza.io https://github.com/otalk/stanza.io Modern XMPP in the browser, with a JSON API. Stanza.io is a library for using modern XMPP in the browser, and it does that by exposing everything as JSON. Unless you insist, you have no need to ever see or touch any XML when using stanza.io. Useful when connecting directly to a websocket enabled XMPP server and you have built custom server modules to handle your business logic.

CLIENTS: STANZA.IO Example Echo Client var XMPP = require('stanza.io'); // if using browserify var client = XMPP.createClient({ jid: 'echobot@example.com', password: 'hunter2', }); transport: 'websocket', wsurl: 'wss://example.com:5281/xmpp-websocket' client.on('session:started', function () { client.getroster(); client.sendpresence(); }); client.on('chat', function (msg) { client.sendmessage({ to: msg.from, body: 'You sent: ' + msg.body }); }); client.connect(); Borrowed from the stanza.io README

CLIENTS Hedwig https://github.com/scrogson/hedwig XMPP Client/Bot Framework Hedwig is an XMPP client and bot framework written in Elixir. It allows you to build custom response handlers to fit your business logic. Simply configure Hedwig with credentials and custom handlers and you're set!

CLIENTS: HEDWIG Hedwig Client Configuration use Mix.Config alias Hedwig.Handlers config :hedwig, clients: [ %{ jid: "juliet@im.capulet.lit", password: "R0m30!" nickname: "romeosgirl", resource: "balcony", rooms: [ "lobby@conference.im.capulet.lit" ], handlers: [ {Handlers.Help, %{}}, {Handlers.GreatSuccess, %{}} ] } ]

CLIENTS: HEDWIG Example Handler defmodule Hedwig.Handlers.GreatSuccess do use Hedwig.Handler @links [ "http://mjanja.co.ke/wordpress/wp-content/uploads/2013/09/borat_great_success.jpg", "https://www.youtube.com/watch?v=r13riarkgo0" ] def handle_event(%message{} = msg, opts) do cond do hear ~r/great success(!)?/i, msg -> process msg true -> :ok end {:ok, opts} end def handle_event(_, opts), do: {:ok, opts} defp process(msg) do :random.seed(:os.timestamp) link = Enum.shuffle(@links) > List.first reply(msg, Stanza.body(link)) end end

COMPONENTS

COMPONENTS XEP-0114: Jabber Component Protocol Allows you to extend server functionality External - connects to server or vice versa Handshakes and authenticates with the server Can be written in any language Can interact on the whole domain or subdomain Can alter stanzas including the to/from attributes

PHOENIX Phoenix https://github.com/phoenixframework/phoenix Elixir Web Framework Phoenix is a web framework targeting full-featured, fault tolerant applications with realtime functionality. It has support for WebSockets baked-in.

PHOENIX Router defmodule MyApp.Router do use Phoenix.Router pipeline :browser do plug :accepts, ~w(html) plug :fetch_session end pipeline :api do plug :accepts, ~w(json) end scope "/", alias: MyApp do pipe_through :browser get "/pages/:page", PageController, :show resources "/users", UserController do resources "/comments", CommentController end end scope "/api", alias: MyApp.Api do pipe_through :api resources "/users", UserController end channel "xmpp", XMPPChannel end

IDEAS

IDEAS XMPP Server Hedwig Client XMPP Channel Phoenix WebSocket Client

DEMO?

Fragen?

Danke!