https://github.com/janjiss/ruby_bosh_mongoose
https://github.com/janjiss/ruby_bosh_mongoose
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/janjiss/ruby_bosh_mongoose
- Owner: janjiss
- License: mit
- Created: 2014-11-13T13:53:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-13T13:54:40.000Z (over 10 years ago)
- Last Synced: 2025-01-10T17:20:19.980Z (5 months ago)
- Language: Ruby
- Size: 156 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
ruby_bosh
=========The RubyBOSH library handles creating and pre-authenticating BOSH streams inside your Ruby application before passing them off to your template engine.
This method allows you to hide authentication details for your users' XMPP accounts.
Tested on Rails 2.x with eJabberd 1.2+
References
==========
BOSH: http://xmpp.org/extensions/xep-0124.html
XMPP via BOSH: http://xmpp.org/extensions/xep-0206.htmlExample
=======
In your Ruby app controller (or equivalent):@session_jid, @session_id, @session_random_id =
RubyBOSH.initialize_session("[email protected]", "my_password", "http://localhost:5280/http-bind")If you want to define your own resource name, include it within the jid. RubyBOSH will create a random one if none is supplied.
To define a resource name of 'home', do the following:@session_jid, @session_id, @session_random_id =
RubyBOSH.initialize_session("[email protected]/home", "my_password", "http://localhost:5280/http-bind")In your template, you would then pass these directly to your javascript BOSH connector:
var bosh_jid = '<%= @session_jid %>';
var bosh_sid = '<%= @session_id %>';
var bosh_rid = '<%= @session_random_id %>';// using Strophe:
connect.attach(bosh_jid, bosh_sid, bosh_rid, onConnectHandlerFunction);Acknowledgements
================
Jack Moffit
- thanks for the nice Django example :)
#=> http://metajack.im/2008/10/03/getting-attached-to-strophe/Copyright (c) 2008 Pradeep Elankumaran. See LICENSE for details.