} }); const App = React.createClass({ getInitialState() { return { roster: undefined, showOffline: false, presence: {}, status: "disconnected" }; }, handleConnect(jid, password) { this.setState({ status: "connecting", error: undefined, presences: {}, roster: undefined }); const connection = this.connection = new Strophe.Connection(`https://${Strophe.getDomainFromJid(jid)}/http-bind`); // connection.rawInput = (data) => { console.log('RECV: ' + data); }; // connection.rawOutput = (data) => { console.log('SEND: ' + data); }; connection.connect(jid, password, safeCB(status => { if (status === Strophe.Status.CONNECTING) { this.setState({ status: "connecting" }); } else if (status === Strophe.Status.CONNFAIL) { this.setState({ status: "disconnected", error: "failed to connect" }); } else if (status === Strophe.Status.DISCONNECTING) { this.setState({ status: "disconnecting" }); }