• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Mongooze citizen
 

Mongooze citizen

on

  • 1,317 views

 

Statistics

Views

Total Views
1,317
Views on SlideShare
1,317
Embed Views
0

Actions

Likes
1
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Mongooze citizen Mongooze citizen Presentation Transcript

    • MongooseCitizen of the World (Wide Web)
    • Who are you?Webmaster of social site?Desginer of corporate page?Backend developer?Geek with full stomach after lunch?
    • How can you embed a chat?Combine PHP, JavaScript and storingmessages in MySQL.Use existing plugin/library and externalchat server.Make custom server with REST/Websocketsinterface.Or...
    • Host your own chatAll you need is dedicated server whereyou can install Erlang, MongooseIM andopen chosen ports in firewall.May use the server with webpage.Integrate existing JavaScript XMPPlibraries with MongooseIM BOSH andWebsockets endpoints.
    • Why XMPP?Proven, popular protocolLots of extensionsMany server and client implementationsEasy to comprehend:<message from=”john@example.com/macbook”to=”alice@example.com/nokia”><body>Hello Alice!</body></message>
    • XEP-0239: Binary XMPP• Traditional stanza: <presence/>• Binary representation:0011110001110000011100100110010101110011011001010110111001100011011001010010111100111110• Binary XMPP representation:<zero/><zero/><one/><one/><one/><one/><zero/><zero/><zero/><one/><one/><one/><zero/><zero/><zero/><zero/><zero/><one/><one/><one/><zero/><zero/><one/><zero/><zero/><one/><one/><zero/><zero/><one/><zero/><one/><zero/><one/><one/><one/><zero/><zero/><one/><one/><zero/><one/><one/><zero/><zero/><one/><zero/><one/><zero/><one/><one/><zero/><one/><one/><one/><zero/><zero/><one/><one/><zero/><zero/><zero/><one/><one/><zero/><one/><one/><zero/><zero/><one/><zero/><one/><zero/><zero/><one/><zero/><one/><one/><one/><one/><zero/><zero/><one/><one/><one/><one/><one/><zero/>
    • Our little carnivoreVery strong claws todig through lots ofmessagesAble to deal withmultiple meals serversin clusterAdopts very well toEurasian and Africanmodern Web environment.
    • Getting MongooseDownload package from ESL website or repoClone git repository:https://github.com/esl/ejabberd
    • Mongoose’s reflexServer:AMD FX-8150 8x3.3GHz32GB RAMOne big room:3000 users10 messages per secondMultiple rooms:2000 rooms25 users/room0.6 message per second per room
    • Case Study: Erlang CentralErlang Factory streamsGroupchats for live streams were first.Use MUCkl (with JSJaC as backend)embedded in a very straightforward way(<iframe>).Taps into Wordpress cookies and uses themfor authenticating users.
    • Client-sideConnects to MongooseIM via WebsocketsAuthenticates with user login andWordpress ‘logged in cookie’Cookie format:piotr_nosek|1368010779|49aa66843380c377e93b198b966eb699user login exp. date magic hash
    • Steps to create magic hash1. Frag = password_hash[8:11]2. HMACKey = logged_in_key + logged_in_salt3. HMACData = username + Frag + ‘|’ + ExpTime4. HMAC = hmac(md5, HMACData, HMACKey)5. MagicHash = hmac(md5, username + ‘|’ +ExpTime, HMAC)
    • Server-side moduleejabberd_auth_wordpress.erlReproduces Wordpress ‘logged in cookie’Compares it with provided password(cookie)Generated from user password hashfragment, user login, expiration date andsalt defined by administrator
    • Facebook-like global groupchatUses xmpptk (with JSJaC backend, likestream chats)Chosen BOSH instead of WebsocketsWebsockets are closed on page reloadTest drive for MongooseIM reimplementedBOSH supportCase Study: Erlang CentralErlang Central Cafe
    • Client-sideUses cookie generated in similar way to‘logged in cookie’.Modified xmpptk and jQuery chat box tofit into Wordpress plugin and matchErlang Central look and feel.
    • Server-sideCompares password (cookie) againstgenerated hash.New BOSH implementation.For 3rd party clients: hashes passwordwith Erlang implementation of phpass andchecks against hash stored in DB.
    • (Side) Effects ofErlang Central chatsReal application for Websockets and new BOSHsupportPeople watching stream have a way of tellingcamera guy to show slides, not just speaker face.:)Modules for integrating Erlang with Wordpressand/or PHP:Cafe pluginphpass implementation
    • Useful linksMongooseIM load tests - full articlehttp://soerlang.tumblr.com/post/35563581435/esl-mongooseim-vs-p1-ejabberd-part-i-piotr-nosekMUCklhttps://github.com/sstrigler/MUCklxmpptkhttps://github.com/sstrigler/xmpptkWordpress auth for MongooseIM:https://github.com/esl/ejabberd, ‘wordpress’ branchCafe plugin: To Be ReleasedDetailed tutorials (self-advertisement ;))http://getcookie.wordpress.com
    • Thank you!Köszönöm!And see you again in erlang:get_cookie() blog. ;)