Your SlideShare is downloading. ×
Mongooze citizen
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Mongooze citizen

1,318
views

Published on

Published in: Technology, News & Politics

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,318
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. MongooseCitizen of the World (Wide Web)
  • 2. Who are you?Webmaster of social site?Desginer of corporate page?Backend developer?Geek with full stomach after lunch?
  • 3. 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...
  • 4. 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.
  • 5. 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>
  • 6. 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/>
  • 7. Our little carnivoreVery strong claws todig through lots ofmessagesAble to deal withmultiple meals serversin clusterAdopts very well toEurasian and Africanmodern Web environment.
  • 8. Getting MongooseDownload package from ESL website or repoClone git repository:https://github.com/esl/ejabberd
  • 9. 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
  • 10. 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.
  • 11. Client-sideConnects to MongooseIM via WebsocketsAuthenticates with user login andWordpress ‘logged in cookie’Cookie format:piotr_nosek|1368010779|49aa66843380c377e93b198b966eb699user login exp. date magic hash
  • 12. 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)
  • 13. 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
  • 14. 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
  • 15. 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.
  • 16. 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.
  • 17. (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
  • 18. 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
  • 19. Thank you!Köszönöm!And see you again in erlang:get_cookie() blog. ;)