web sockets & messaging solutions applied in the mobile ... · 4 1 web sockets & messaging...

23
1 Chapter 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment Bogdan Rebedeu Software Systems Engineering Masters, RWTH University 1.1 Introduction “WebSocket is a web technology providing for bi- directional, full-duplex communications channels over a TCP connection.”[6] Additionally, it provides a stable connection over a mobile link, for example, issuing reconnects when necessary [7]. In section 2, the technologies discussed in this papers will Section 2 - Foundations and Technologies be introduced as follows: Web Sockets, Ambient Talk, XMPP, XMPP Publish-Subscribe Pattern, Mobilis and Faye. Then a discussion about the advantages and disadvantages of the different approaches will take place in section 3. Section 3 - Analysis The discussion will be closed up with a comparison be- tween the three (Ambient Talk, Mobilis, Faye).

Upload: others

Post on 05-Aug-2020

6 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1

Chapter 1

Web Sockets &Messaging SolutionsApplied in The MobileEnvironment

Bogdan RebedeuSoftware Systems Engineering Masters, RWTH University

1.1 Introduction

“WebSocket is a web technology providing for bi-directional, full-duplex communications channels over aTCP connection.”[6]Additionally, it provides a stable connection over a mobilelink, for example, issuing reconnects when necessary [7].

In section 2, the technologies discussed in this papers will Section 2 -Foundations andTechnologies

be introduced as follows: Web Sockets, Ambient Talk,XMPP, XMPP Publish-Subscribe Pattern, Mobilis and Faye.

Then a discussion about the advantages and disadvantagesof the different approaches will take place in section 3. Section 3 - AnalysisThe discussion will be closed up with a comparison be-tween the three (Ambient Talk, Mobilis, Faye).

Page 2: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

2 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

1.2 Foundations and Technologies

Here in this section all the discussed technologies and someother needed prerequisites are introduced.

1.2.1 Web Sockets

The WebSocket provides “full-duplex bi-directional chan-nels of communications over a TCP connection”[6].Web Sockets

standard as definedby the IETF. The WebSocket Protocol, defined by IETF, “enables two-

way communication between a client running untrustedcode in a controlled environment to a remote host that hasopted-in to communications from that code”[6].

“The security model used for this is the origin-based secu-rity model commonly used by web browsers.”[6]

“The protocol consists of an opening handshake followedby basic message framing, layered over TCP. The goal ofthis technology is to provide a mechanism for browser-based applications that need two-way communication withservers that does not rely on opening multiple HTTP con-nections (e.g., using XMLHttpRequest or ¡iframe¿s andlong polling).”[6]

W3C standardized the WebSocket API. This enables Webpages to use the WebSocket protocol. The specification re-lies on several other underlying specifications, for example:HTML [7].

Further presented technologies rely on the WebSockets.

1.2.2 AmbientTalk

“AmbientTalk is an experimental object-oriented dis-tributed programming language.” It is primarily targetedat writing programs deployed in mobile ad-hoc networks[5].

Page 3: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.2 Foundations and Technologies 3

It can be easily used to create applications for the Androidmobile platform.

“AmbientTalk is a research platform to experiment withnew language features or programming abstractions to fa-cilitate the construction of software that has to run in highlyvolatile networks exhibiting intermittent connectivity andlittle infrastructure.”[5] E is a pure-object

secure distributedpersistent scriptinglanguage plaform

The concurrency features of the language are highly in-fluenced by the E programming language [5]. Theobject-oriented features of the language are influenced bySmalltalk [5]. The language has also a functional core,which is inspired by Scheme and Pico [5]. Pico is a

programminglanguage designedto teach computerscience concepts tonon-computerscience students.

The main differences from the mainstream languages are[5]:

• employs a purely event-driven concurrency frame-work, founded on actors;

• instead of RPC abstraction, uses asynchronous, non-blocking message passing (this helps the programmerabstract from network problems, because the systembuffers the messages automatically when the receiverof the message gets disconnected); RPC - Remote

Procedure Call

• built-in programming constructs for objects to dis-cover one another in the local network (peer-to-peer ser-vice discovery is built into the language);

• dynamic OO kernel built upon the principle ofprototype-based programming (kernel supports re-flection using mirrors);

• syntax derives from curly brace family of languages,but still uses some keywords from Smalltalk;

• current implementation embraces JVM as a platform JVM - Java VirtualMachine(Java libraries are easily used by AmbientTalk pro-

grams, and AmbientTalk is easily used by Java objectsas an embedded scripting language).

Page 4: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

1.2.3 XMPPeXtensibleMessaging andPresence Protocol XMPP is an open-source communications protocol stan-

dard for MOM, built on top of XML. It was originally devel-oped by the Jabber open-source community and also calledJabber [11] [13].

MOM is the infrastructure (hardware and/or software)MOM -Message-orientedmiddleware

that supports sending and receiving messages between dis-tributed systems. It allows application modules to be multi-platform distributed and reduces the development com-plexity of applications that span over different operatingsystems and/or different network protocols. “The middle-ware creates a distributed communications layer that insu-lates the application developer from the details of the var-ious operating system and network interfaces. APIs thatextend across diverse platforms and networks are typicallyprovided by MOM.”[4]

It is designed to be an extensible instant messaging service,including list of contacts, presence information and onlinecollaboration. Because of its extensible characteristic, theprotocol has been used in many applications. Some ofthem are publish-subscribe systems, signaling for VoIP, filetransfer, social networking and in-game-communications(all these being made possible also by the open-source de-velopment approach) [13] [11].The XMPP specification has been formalized in 2002-2003by the IETF. Three standards resulted: XMPP Core (RFC6120), XMPP IM&Presence (RFC 6121) and XMPP AddressFormat (RFC 6122).IM - Instant

Messaging (e.g.Yahoo Messenger,MSN Messenger)

XMPP is implemented by lots of applications, and libraries.“The implementations are provided under a high variety ofsoftware licenses.”[13]Ovi by Nokia is the

brand for Nokia’sInternet services.The Ovi services, areboth for mobile andfor computer. Nokiafocuses on five keyservice areas:Games, Maps,Media, Messagingand Music.

XMPP is natively used by several famous well developedIM services (e.g. GoogleTalk, Ovi from Nokia).Some hosting services (e.g. DreamHost) provide their cus-tomers, besides traditional web and email services, XMPPservices. All this eases the work of domain owners, whonow do not need to directly run their own XMPP servers.Services like that are: WebEx Connect, Chrome.pl,Flosoft.biz, i-pobox.net, and hosted.im.

Page 5: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.2 Foundations and Technologies 5

The XMPP Standards Foundation or XSF (previouslyknown as Jabber Software Foundation) is actively developingopen XMPP extensions. However, any individual, softwareproject, or organization can define extensions. For exam-ple, Google has defined a number of non-XSF extensions,which are used in Google Talk and Google+ (e.g., for sig-naling related to Google Hangouts). Another example isthe XMPP-based federation protocol in Apache Wave [13][11] [12]. SIP (Session

Initiation Protocol) isa signaling protocolused for controllingsessions ofcommunication (e.g.voice calls over IP,video calls over IP);SIP has beendefined in 2002 byIETF as a proposedstandard [9].

As competitors (other developments on a similar topic withthe same purpose), XMPP has as a competitor, on the side ofstandard protocol for instant messaging and presence noti-fication, SIMPLE, which is based on SIP protocol [13].On the part of multi-user chat, XMPP’s extension for multi-user chat can be seen as a competitor for IRC, even if theXMPP extension is not as wide spread as IRC [13].

IRC - Internet RelayChat (many whoused to be windowsusers 8-10 years agomay remember it asmIRC)

The extensions for publish-subscribe provide features sim-ilar to The AMQP, which is also an open-source applicationlayer protocol for MOM [13] [12].

AMQP - AdvancedMessage QueuingProtocol

The XMPP Standards Foundation is managing the devel-opment of extensions to XMPP through XMPP ExtensionProtocols. It involves a whole life cycle of discussions, test-ing, voting etc [11].They provide all the time a complete list of all the exten-sion protocols, including those that were rejected, retractedor deprecated) [11].

1.2.3.1 Publish-Subscribe

“The XMPP publish-subscribe extension provides a frame-work for a wide variety of applications, including newsfeeds, content syndication, extended presence, geolocation,avatar management, shared bookmarks, auction and trad-ing systems, work flow systems, network management sys-tems, NNTP gateways, profile management, and any otherapplication that requires event notifications.”[8]

“This technology uses the classic publish-subscribe or ob-server design pattern: a person or application publishes in-formation, and an event notification (with or without pay-

Page 6: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

6 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

load) is broadcast to all authorized subscribers. In gen-publish-subscribepattern is also knownas the observersoftware designpattern

eral, the relationship between the publisher and subscriberis mediated by a service that receives publication requests,broadcasts event notifications to subscribers, and enablesprivileged entities to manage lists of people or applicationsthat are authorized to publish or subscribe. The focal pointfor publication and subscription is a node to which publish-ers send data and from which subscribers receive event no-tifications. Nodes can also maintain a history of events andprovide other services that supplement the pure PubSubmodel.”[8]

The basic idea is the following [8]:

1. User publishes information to a node of the publish-subscribe service.

2. The PubSub service pushes an event notification to allthe users that are authorized to receive the publishedinformation.

The requirements are based on both the user needs and theneeds of ofther components and services which use the ser-vice [8].Basic features that implement the publish-subscribe pattern[8]:

• An entity MUST be able to publish events to a servicesuch that all subscribers to a node receive notificationof the event.Requirements

formally defined withthe standard, by theXMPP StandardsFoundation

• An entity MUST be able to subscribe to a node (or beinformed that subscription is not allowed).

• An entity MUST be allowed to be affiliated with anode. Allowable affiliations are member, none, out-cast, owner, publish-only, and publisher. Implemen-tations MUST support affiliations of none and owner,and MAY support affiliations of member, outcast,publisher, and publish-only.

• An entity MUST be allowed to query the pubsub ser-vice (or a specific node) to determine what optional

Page 7: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.2 Foundations and Technologies 7

features of this specification the service (or node) im-plements. This query MUST use the Service Discov-ery (disco#info) protocol.

Optional features [8]:

• A service MAY cache the last item published to anode (even if the persistent-items option is set to false);if it does default cache-last-item to true, it SHOULDsend the last published item (or notification thereof)to subscribed entities based on configuration of thesend last published item field.

• A node owner SHOULD be able to specify who maysubscribe to a node.

• A node owner SHOULD be able to specify who maypublish to a node.

• A node MAY be configured to deliver the publishedpayload inside the event notification. Requirements that

do not always needto be met in order torespect the standard.

• A node MAY be configured to persist published itemsto some persistent storage mechanism.

• A node MAY be configured to persist only a limitednumber of items.

• A service MAY support collections as described inXEP-0248.

• A service or node MAY support extended service dis-covery information (meta-data).

1.2.4 Mobilis

The Mobilis project has been developed at the ComputerNetworks Group of the Department of Computer Scienceof TU Dresden. The background of the project is PervasiveSocial Computing and one of the main technologies used isXMPP [15]. Mobilis is totally

based on XMPP

Page 8: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

8 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

The Mobilis platform was developed for collaborative mo-bile applications. It is intended to support and ease de-velopment of collaborative applications for mobile devices,like smartphones. It is also intended for parts of the serverdevelopment and web clients. Given the mobile-orientedapproach it is suitable even for ad-hoc connected sensorsand actuators [14].It is currently targeting Android as a smartphone plat-form, but extensions are going to be made. For webclient/interface the target is HTML5.

The Use Cases Focus on the real-time Collaboration [2] [13]:

• Map-based group interaction (e.g. fleet management,car sharing)

• Proximity-based services (e.g. finding nearby friendsof offers)The initial focus of

the project (but notlimited... it may beextended).

• Location-based games (e.g. exploring a city or build-ing collaboratively)

• Collaborative work (e.g. shared editing, shared draw-ing)

• Usage of ubiquitous devices (smartphones, tablets,notebooks)

“Social Computing, especially online social networks likeFacebook, Google Plus or Twitter are now killer applica-tions for the mobile Internet. But the potential of socialapps on smart phones and other pervasive devices in theuser’s environment is not yet fully exploited.”[15]“Smart phone sensors as well as sensors and actuators inPervasive Social

Computing ismultidisciplinaryparadigm, thatcombines pervasivecomputing, socialmedia, socialnetworking, socialsignal processing,etc [16].

the natural surroundings of a person could be used to de-rive comprehensive knowledge about the physical environ-ment and nearby people and their behavior, social linksand activities.”[15] “Social and collaborative apps takingadvantage of this rich awareness are called Pervasive SocialComputing applications. They allow their users to interactseamlessly with devices and other people in their naturalsurroundings.”[15]

Page 9: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.2 Foundations and Technologies 9

“The goal of the Mobilis project is to ease the developmentof apps for Pervasive Social Computing especially for non-commercial developers who often lack the resources neces-sary to develop a complex pervasive application.”[15]

Figure 1.1: The System Overview. Reprinted with permis-sion from [15]

A brief overview ofthe Mobilis Project

The project a service platform is delivered. This supportsdevelopers in creating collaborative social applications. Italso adds abstraction from network problems, thus easingthe development and reducing the time needed for devel-opment. Some basic collaboration services are: group man-agement, multi-user chat, shared editing, location services,map services, file sharing.[15]In addition an integration service for social networks likeFacebook has been defined. The eXtensible Messaging andPresence Protocol (XMPP) has been selected fo be the basis basis - acting as a

glue that connects allcomponents together

of the service platform because it provides service featurerich communication, but not only that. It also provides pro-tocols and functions for management of services. As a mo-bile device platform, Android has been chosen. This will beextended later to other platforms, like iOS.[15]

“To test this approach various collaborative social applica-tions have been implemented by the combination of basicservices.”[15]

Page 10: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

10 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

• “MobilisGuide supports groups of tourists to stayconnected even if they split up. By means of a map-based view group members are aware of the otherslocation and activities, can share multimedia contentand communicate together.”[15]

• “MobilisBuddy shows the location of buddies im-ported from Facebook on a map if they are in theusers proximity. In this way they can for instance ini-tiate spontaneous meetings.”[15]

• “MobilisMapDraw enables the simultaneous draw-ing of several users in a group on a map, for instanceto discuss a route.”[15]

• “MobilisMedia allows the exchange of multimediacontent between groups of users.”[15]

“The implementation of manifold collaborative social ap-plications for mobile devices using the Mobilis platformdemonstrates the value of flexible composable collabora-tion services.”[15]“The re-usability of basic services significantly reduces thedevelopment effort for value-added services.”[15]

“The MobilisServer offers various services to the client ap-plications, for example to manage and save media data, tocollaboratively edit documents and to create and managelocation-based groups.All these services have their own XMPP-ID and can beused directly via XMPP messages. The XMPP client li-brary Smack is used for the communication. Mobilis rec-ommends to use Openfire as XMPP server, but other XMPPservers can also be used.”[15]A better and more

detailed view of thearchitecture of thesystem.

The Smack Library has to be adjusted in order to allowconnection establishment on the client-side. Therefore

MXA - Mobilis XMPPon Android

the application MXA encapsulates the Smack XMPPfunctionality.[15]

“The component Mobilis Beans is a collection of structures,which help to create various XMPP packets that are ex-changed between the MobilisServer and the clients. Devel-opers can use the Mobilis Beans to make concrete requeststo the server-side services.”[15]

Page 11: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.2 Foundations and Technologies 11

Figure 1.2: The Architecture of The Mobilis Project.Reprinted with permission from [14]

“In the library Mobilis Client Services developers of Androidapplications can find services that can be integrated easilyinto other apps. For example the Social Network Servicefacilitates the integration of external social networks.”[15]

1.2.5 Faye

“Faye is a publish-subscribe messaging system based onthe Bayeux protocol.”[3] AJAX -

AsynchronousJavaScript and XML -It is a set oftecniques forasynchronousclient-side webapplicationsdevelopment.

“The primary purpose of Bayeux is to support responsivebidirectional interactions between web clients, for exampleusing AJAX, and the web server.”[10]

“Bayeux is a protocol for transporting asynchronous mes-sages (mainly over HTTP), with low latency between a webserver and a web client.The messages are routed via named channels and can bedelivered:

• server to client

• client to server

Page 12: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

12 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

• client to client (via server)

By default, publish subscribe routing semantics are appliedto the channels [10].

Delivery of asynchronous messages from the server to aweb client is often described as server-push.The combination of server push techniques with an Ajaxweb application has been called Comet.CometD is a project by the Dojo Foundation to providemultiple implementation of the Bayeux protocol in severalprogramming languages.”[10]

Bayeux is reducing the development complexity for Cometweb applications. This is done by enabling easier interop-erability between the implementors. This collaboration isdone with the purpose of solving routing problems or com-mon message distribution. For this they provide mecha-nisms for extensions and also improvements, both done in-cremental [10].

Faye “provides message servers for Node.js and Ruby, andclients for use on the server and in all major web browsers”[3].

“It also includes a solid set of tools for easily building plainWebSocket servers and clients, compatible with a widerange of protocol versions.”[3]

Many implementations use Faye, like: Buster.js, Chaxpert,Cloud Blocks, GroupMe, I.Neda, patient, Podio, Shopify, Xydo[3].Many web

applications rely onthis approach

“Both the Ruby and JavaScript versions share the same in-ternal structure and their implementations are very similar.Being based on Bayeux protocol, is compatible with thereference implementation of Bayeux provided by cometDproject.”Messages flow through the system according to the dia-gram from 1.3 [3].

“The components that make up the messaging stack are

Page 13: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.2 Foundations and Technologies 13

Figure 1.3: Faye Internal Architecture. Adapted from [3]

modular such that each layer is easily swappable if needed.The storage layer is the base of the whole stack, and as itsname suggests it stores the state of the Faye service. Thisstate includes a list of active client IDs, which channels eachclient is subscribed to, and any queued messages waiting tobe delivered to clients.The engine is an object that provides an abstract API on topof the storage layer. It implements all the core operationsof the Faye service, such as registering new clients, storingsubscriptions and routing messages.The server implements the Bayeux messaging protocol.The server-side extensions are the components written by theuser that intercept messages that flow in and out the Server.Incoming extensions apply when a message comes in to Overview of the

layered architectureof Faye, alsoshowing the flow ofthe messagesthrough the system.

the server from the Internet, and outgoing extensions ap-ply when a message is being sent back out to the client. Theuser can change the messages’ data, and add errors to stopthe Server processing them.The adapter exposes the Server’s interface over HTTP.

Page 14: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

14 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

The transport classes implement the side of the networktransports supported by the server-side Adapter. Their jobis to accept messages from the Client, serialize them andsend them to the server. When responses arrive they aredeserialized and given to the Client.The client-side extensions are components written by the userthat intercept messages that flow in and out of the Client.Outgoing extensions apply when a message is sent by theClient, and incoming extensions apply when a message ar-rives from the server.The client is the component that the user interacts with themost, and provides the interface through which subscrip-tions are registered and messages are published. The clientimplements the client-side of Bayeux protocol, and presentsa higher level interface to the user.”[3]

1.3 Analysis

Here, in the main part of the paper, all the introduced tech-nologies are analyzed.

1.3.1 AmbientTalk

As a programming language, AmbientTalk has the follow-ing characteristics [5]:AmbientTalk made

as a research tool,not as a tool to beused in the industry. • dynamically typed, but not untyped! (values are typed,

but variables are untyped);

• object-oriented, prototype based: provides full sup-port for objects, delegation and polymorphic mes-sage dispatch; unlike in Smalltalk, objects are createdfrom existing prototypes (and not instantiated fromclasses), or created ex-nihilo, as in Self.ex-nihilo - “out of

nothing”• flexible: “uses the elegant and expressive block clo-

sures to achieve a level of reusability far exceedingthat of Java or similar languages lacking true clo-sures”;

Page 15: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.3 Analysis 15

• event-driven: “has built-in support for actor-basedconcurrency, which operates based on asynchronousand event-driven communication”;

• distributed: “has built-in language constructs tomake objects discover and talk to one another in apeer-to-peer manner across a TCP/IP network”;

• symbiotic: being built on top of the JVM, it “exploits JVM - Java VirtualMachinethe Java reflection API to enable AmbientTalk Ob-

jects to collaborate with Java Objects”. This allowsthe developers to use the Java libraries without need-ing to abandon dynamic programming style of Am-bientTalk.

On the other hand, AmbientTalk still misses some qualities[5]:

• still misses to be a “stable, optimized and scalable de-velopment platform” (it is designed to be a “researchartifact, used as a programming language laboratoryin the form of an interpreter”); it is mainly used “to Due to the fact that it

was not made for theindustry, from somepoint of view weexperience badquality.

experiment with and discover new language abstrac-tions for distributed computing in mobile ad-hoc net-works”;

• can not be considered a “secure distributed comput-ing platform”;

• it is not “a language-neutral or customizable dis-tributed computing platform”.

In conclusion, even if AmbientTalk provides many interest-ing features and eases a lot the work of developers, is stilljust a programming language to be used with research pur-poses and not for releases. The open-source nature makesit available for anyone needs/wants to use it in the ownresearch.

1.3.2 XMPP

The strong points of XMPP brought it on a good position ofbeing used in many implementations. Some of the strong

Page 16: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

16 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

points are [13]:

• Decentralization - XMPP network architecture is simi-lar to email; anyone can run their own XMPP serverindependent of any kind of central application server.

• Standardization - the IETF has formalized XMPP asIETF - InternetEngineering TaskForce

instant messaging and presence information technol-ogy and provided it as a standard (RFC 6120 and RFC6121).

• Open-source - the provided standard is delivered as anopen-source software, being available for free for any-one who wants to see, use or extend the specification.

• History - XMPP technologies have a broad history(since 1999). This giving it enough time to get widespread and well known. Now, plenty of XMPP stan-dards exist for both client and server applications, butalso for components and for code libraries.We can also have

the highest level ofsecurity ever(unplug), with stillenough benefits.

• Security - one can implement the server independentfrom the public network, providing isolation fromany kind of security threat; also strong security isbuilt in the core specifications of XMPP.

• Flexibility - on top of XMPP, custom functionality canbe can be added; the XMPP Software Foundationis managing all the common extensions in order tomaintain a good interoperability. XMPP SoftwareFoundation is currently managing a wide range of ex-tensions and XMPP applications.

But XMPP has also some weaknesses [13]:

• Inefficient in-band binary data transfer - because XMPPis still encoded as long-lived XML stream (still not yetEfficient XML Interchange encoded), some additionalconversion to base64 has to be performed before in-band transmission is performed. “Therefore any sig-nificant amount of binary data (e.g., file transfers) isbest transmitted out-of-band, using in-band messagesto coordinate.” (e.g. Jingle XMPP Extension Protocol,XEP-0166)

Page 17: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.3 Analysis 17

Despite the possible problems, XMPP is widely used. Itsusage is increasing day by day. More and more implemen-tations, extensions and variations appear every day.Some of these implementations, also presented in this pa-per, are: Mobilis, Node.js and Faye.

1.3.3 Mobilis

During the Mobilis project development, several difficul-ties (research issues) were encountered [15]:

• Use Cases (Demo Applications)

• Mobility-aware Reliable CommunicationHere a couple of problems arise when performingoutdoor tests, while in the emulator everything wentfine.

• Re-usable ServicesSome of the functionality, which is common, beingmade reusable for other apps also (and avoid uselesscode rewriting).

• Pervasive Social Service EnvironmentA new deployment (e.g. a new version deployment)of a service would need to shut down the whole Mo-bilis Server, in order to compile.

• Session MobilityHandling multiple devices is also an issue.

According to current download statistics of the Mobilisproject support, statistics provided by sourceforge.net, Ger- New, not yet

bug-free, but alreadyquite popular.

many is the country where the Mobilis Project is the mostpopular. Here the number of downloads is almost 4 timeshigher than the second in the statistics.The next countries where this is popular are: Romania,Brazil, United States and China. This shows the interna-tional widespread research interest regarding this project.

Page 18: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

18 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

1.3.4 Faye

The Faye messaging system is used in many implementa-tions that rely on the publish-subscribe pattern.

The architecture of Faye provides a couple of advantages:

• The layered architecture allows changes to be done toa part of the system without big changes to the otherparts of the system.Features that make

Faye a perfectcandidate for theindustry...

• Complete abstraction and separation between the lay-ers of the system internal architecture.

• The separate Server layer permits an easy change ofthe backend implementation, and also keeping theprotocol layer consistent [3].

• Separate Adapter layer that performs the serializingand deserializing of messages (easy to replace thispart with different implementations).

• The Client layer [3] allows a high-level user interac-tion, providing abstraction from handshakes, connec-tions etc, which are done automatically.

• The Clustering feature [3] provided by Faye enginesprovide scaling opportunities, increasing the maxi-mum number of network connections allowed by onemachine. This has the disadvantage that the engineswill get slower, because of the need to perform moreI/O to external services (the storage layer is the samefor all the clusters).

1.3.5 Conclusions

In this paper we discussed a broad range of messaging so-lutions and implementations.

Ranging from the AmbientTalk solution which is veryhandy and easy to use, without major problematic side-effects.

Page 19: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

1.3 Analysis 19

Unfortunately, there are no proper optimizations available,in order to implement a large scale network.Another problem is that this could never be used in a com-mercial application, while there is no special security im-plemented (since it is designed to be an experimental pro-gramming language for use only for research purposes).

Next possible choice could be the Mobilis Project.Here, unlike AmbientTalk, the development also includesthinking more specific use cases and defining particular in-teraction patterns.It is not so popular and wide spread, but it has the potentialto create commercial applications, therefore proper applica-tions that could be released on the market (or to a particularclient). Even though, the security is still not well enoughdefined and the provided license does not give any legalbindings.The Mobilis Project is still growing, since new parts are stillbeing currently developed and others tested and integratedinto the system.Parts like:Mobilis in a Smart Environment [15] (that involves complexevent processing and involving both sensors and actua-tors);Large Displays Support [15] (allowing interaction withlarge displays and bringing Mobilis in public places);Extending the range of supported devices (especially toiOS) [15];Supporting indoor navigation [15];Help the evolution of the Research World with the help ofnew XMPP implementations (Mobilis Peer Services [15]);are still left for future development.

Another solution could be Faye, which is currently (outof the three presented here), the best suitable solution fora commercial environment. It actually is already used insome projects in the industry.Faye provides a more flexible architecture than Ambi-entTalk and MobilisProject. It gives the possibility tochange or interchange parts of the internal architecturewithout wasting too much time understanding and adapt-ing the changed system.Also clustering is possible, therefore easy system scalingopportunities.

Page 20: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

20 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment

Provides good abstraction from connection and networkdetails at implementation time.“Node.js is a platform

built on Chrome’sJavaScript runtimefor easily buildingfast, scalablenetwork applications.Node.js uses anevent-driven,non-blocking I/Omodel that makes itlightweight andefficient, perfect fordata-intensivereal-time applicationsthat run acrossdistributeddevices.”[1]

Provides support for different possible implementations:Node.js and Ruby for the server; and clients that can beused in all major web browsers [3].It is based on the Bayeux protocol[3], which is has a straight-forward way to work. The system is based on the publish-subscribe patter, which is wide spread and known (and alsoeasily understood) by many developers in the world. (mak-ing this system one easy to be understood and easy to beused in their research or other kind of work.

AmbientTalk Mobilis FayeResearch Purpose + + 0 –Reliability – – + + +Easy to use + 0 +OK for non-CS person + + – –Industry usage – – + + +Flexibility – – +Scalability – + + +Security – – + + +Popularity 0 – +Suitable for Mobile + + + + +Platforms Supported – 0 +Degree of Abstraction + + + + +

CS - ComputerScience

1.4 Summary

The paper introduced new technologies. Some of them de-signed to be used in research, others designed to be used inthe industry. They all ended up to have their own pros andcons, each of them being the best in a particular scenario.

Special thanks to the Agile Organizers team for guidanceand valuable information that lead to the possibility ofcompletion of the current paper.Also special thanks to all the authors and contributors ofthe discussed technologies. Obviously, without their workthis paper would have not been possible.

THE END!

Page 21: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

21

Bibliography

[1] Node.js. Technical report, 2010.

[2] S. Bendel, D. S. I. of Computer, and C. N. G. Sci-ence III. Watchmyphone - providing developer sup-port for shared user interface objects in collaborativemobile applications. 2012.

[3] J. Coglan. Faye: Simple pub/sub messaging for theweb. Technical report, MIT, 2012.

[4] E. Curry. Message-Oriented Middleware. John Wiley andSons, Ltd, 2005.

[5] T. V. Cutsem, S. Mostinckx, E. G. Boix, J. Dedecker,and W. D. M. P. T. Lab). Ambienttalk: Object-oriented event-driven programming in mobile ad hocnetworks. 2007.

[6] I. Fette and A. Melnikov. The WebSocket Protocol.RFC 6455 (Proposed Standard), Dec. 2011.

[7] I. Hickson. The web sockets API. W3C working draft,W3C, dec 2009. http://www.w3.org/TR/2009/WD-websockets-20091222/.

[8] P. Millard, P. Saint-Andre, and R. Meijer. Xep-0060:Publish-subscribe. 2010.

[9] J. Rosenberg, H. Schulzrinne, G. Camarillo, A. John-ston, J. Peterson, R. Sparks, M. Handley, andE. Schooler. SIP: Session Initiation Protocol. RFC 3261(Proposed Standard), June 2002.

[10] A. Russell, G. Wilkins, D. Davis, and M. Nesbitt.Bayeux protocol – bayeux 1.0.0. Technical report, 2007.

Page 22: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

22 Bibliography

[11] P. Saint-Andre. Extensible Messaging and PresenceProtocol (XMPP): Core. RFC 3920 (Proposed Stan-dard), Oct. 2004. Obsoleted by RFC 6120, updated byRFC 6122.

[12] P. Saint-Andre. Extensible Messaging and PresenceProtocol (XMPP): Instant Messaging and Presence.RFC 3921 (Proposed Standard), Oct. 2004. Obsoletedby RFC 6121.

[13] P. Saint-Andre, K. Smith, and R. TronA§on. XMPP: TheDefinitive Guide. O’Reilly Media, 2009.

[14] P. A. Schill, S. Bendel, I. Braun, R. LA14bke, C. Magen-

heimer, D. Schuster, and T. Springer. Mobilils project -github website. Technical report, TU Dresden, 2012.

[15] P. A. Schill, S. Bendel, I. Braun, R. LA14bke, C. Magen-

heimer, D. Schuster, and T. Springer. Mobilils projectwebsite. Technical report, TU Dresden, 2012.

[16] J. Zhou, J. Sun, K. Athukorala, and D. Wijekoon. Per-vasive social computing: Augmenting five facets ofhuman intelligence. In Ubiquitous Intelligence Com-puting and 7th International Conference on AutonomicTrusted Computing (UIC/ATC), 2010 7th InternationalConference on, pages 1 –6, oct. 2010.

Page 23: Web Sockets & Messaging Solutions Applied in The Mobile ... · 4 1 Web Sockets & Messaging Solutions Applied in The Mobile Environment 1.2.3 XMPP eXtensible Messaging and Presence

Typeset August 19, 2012