This is a simple guide for getting strophe.js, ejabberd, and IIS all working together on a local dev machine. This assumes you have IIS 7.5 installed and are familiar with the basics of IIS Manager
Step 1: Download and install ejabberd. The install is straight forward and the default configuration has everything you need. During the install it will ask you for a domain. I would recommend setting up a host alias “localhost.demo.com” because it looks nicer and easier to use but you could also just use localhost. After install check to make sure the http-bind endpoint is working http://localhost:5280/http-bind/. You should see a simple page that has “ejabberd mod_http_bind” at the top
Step 1.5: Setup a host name if needed. If you used localhost you can skip this step. You can do this in Windows 7 via the host file which should be located “C:\Windows\System32\drivers\etc\hosts”. Add a line at the bottom with your IP and new local DNS.
Step 2: Setup new IIS application and copy in strophe.js examples. Go into IIS manager and create a new application named “xmppExample”. Then download the latest strophe.js and copy the contents to your new site. You should be able to access the following now. http://localhost.demo.com/xmppExample/strophejs/examples/basic.html. You will have to change the first line in basic.js to setup your endpoint. It should look like this BOSH_SERVICE = ‘http://localhost.demo.com/http-bind’
Step 3: Setup proxy for ejabberd http-bind endpoint. To make things simple we need everything on the same domain. Right now, the bosch http-bind endpoint is this http://localhost:5280/http-bind/ and we need it to be this http://localhost.demo.com/http-bind. Download and install the Application Request Routing for IIS. Once installed follow these steps to enable proxy.
- Open IIS Manager
- Select a server node in the tree view on the left hand side and then click on the “Application Request Routing…” the full name shows up as “Application Request Routing Cache”
- Then on the far right side click on “Server Proxy Settings…
- check the box next to Enable proxy and apply settings (keep everything else default)
Finally, add a rewrite rule to the web.config file in your inetpub root dir. For example, mine is located “C:\inetpub\wwwroot\web.config”. Here is my rewrite section of the configuration file:
<rewrite> <rules> <rule name="ejabberd.BOSH" stopProcessing="true"> <match url="^http-bind" /> <action type="Rewrite" url="http://localhost.demo.com:5280/http-bind/" /> </rule> </rules> </rewrite>
Now you should be able to run the demo at http://localhost.demo.com/xmppExample/strophejs/examples/basic.html. You will need to login with email@example.com (if admin is the username you selected during install) and the password you selected during install.
I can also be found on Google+ Jason Rowe and twitter @jsonrow