Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
3. Setup the nginx and proxy following http://anders.conbere.org/blog/2009/09/29/get_xmpp_-_bosh_working_with_ejabberd_firefox_and_strophe/
#nginx.conf
server {
listen 80;
server_name localhost;
# This regexp did not work for me.
# location ~ ^/http-bind/ {
location /http-bind {
proxy_pass http://localhost:5280;
}
location / {
# This is where you place your strophejs sample.
root /Users/makoto/work/sample/strophejs-1.0;
}
}
# the above will serve 2 uri
http://localhost.local/examples/echobot.html
http://localhost.local/http-bind
4. Modify echobot.js line 1
var BOSH_SERVICE = 'http://localhost.local/http-bind';
5. Open http://localhost.local/examples/echobot.html and type jid(admin@localhost.local) and password(whatever you setup at #1)
# It will show message like this.
Strophe is connecting.
Strophe is connected.
ECHOBOT: Send a message to admin@localhost.local/4199388567126350847984920 to talk to me.
NOTE: If you have Psi opened, it will pop up notification that now you are connected.
6. Send a message(Chat)
From your Psi, right click , select "Open Chat To" , then pick the resource (eg: 4199388567126350847984920)
When you send the message, it will echo what you sent to the browser like this
http://ow.ly/i/iEb
@Thewildfire

This comment has been minimized.

Copy link

Thewildfire commented May 10, 2013

Nice tut

@rahulvramesh

This comment has been minimized.

Copy link

rahulvramesh commented Jul 6, 2013

thanku

@lvsheng4

This comment has been minimized.

Copy link

lvsheng4 commented Apr 6, 2014

thanks

@kmmastermind

This comment has been minimized.

Copy link

kmmastermind commented Apr 11, 2014

I tried to follow the above steps on MAC OS X Lion. It works fine for http://localhost/http-bind but not for http://localhost/examples/echobot.html. It gives me 403 error. I google related to error, but couldn't find the root cause. Please help me. Thanks ind Advance.

@holysoros

This comment has been minimized.

Copy link

holysoros commented Sep 18, 2014

@kmmastermind, nginx user should have x permission in every parent directory of the echobot.html. Refer to http://stackoverflow.com/a/6796648/955947

@anonzi

This comment has been minimized.

Copy link

anonzi commented Oct 17, 2014

nice, thank you very much

@darshanopenxcell

This comment has been minimized.

Copy link

darshanopenxcell commented Dec 25, 2014

Thanks

@dasuxullebt

This comment has been minimized.

Copy link

dasuxullebt commented Oct 5, 2017

This seems to be dead link now :\ could you upload the echo bot somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.