I have set up a simple BOSH and WebSocket server using node-xmpp-bosh
like this:
const nxb = require("node-xmpp-bosh");
const PORT = process.env.PORT || 5280;
const server_options = {
port: PORT,
host: '0.0.0.0',
path: '/http-bind/',
logging: 'INFO'
};
const bosh_server = nxb.start_bosh(server_options);
const ws_server = nxb.start_websocket(bosh_server, server_options);
I've deployed this server to Heroku and now I'm trying to create an XMPP connection with Strophe using it.
var conn = new Strophe.Connection(
"wss://votebot-web-app-bosh.herokuapp.com/http-bind/",
{protocol: "wss"}
);
conn.connect(...);
If I open the browser dev tools, I can see there's a GET request to wss://votebot-web-app-bosh.herokuapp.com/http-bind/
with the HTTP status code 101 Switching Protocols
, but there's no response.
Indeed, the Heroku logs show this error:
[2017-06-09 20:10:17.359] [WARN] [xmpp-proxy-connector.js:Object.stanza:138] - WEBSOCKET d99abd10-683a-485c-a1b8-21f960418523 bosh-stanza - stream not available
I am stuck here so I was wondering if anyone that has already used XMPP over WebSockets could give me any suggestion. Thanks in advance.
Edit: In case it matters, I forgot to add that I can successfully connect to the BOSH service in the same URL (https://votebot-web-app-bosh.herokuapp.com/http-bind/
).
via Jorge Sasiain