Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to xmpp service #896

Closed
abelshare opened this issue May 11, 2021 · 3 comments
Closed

Unable to connect to xmpp service #896

abelshare opened this issue May 11, 2021 · 3 comments

Comments

@abelshare
Copy link

abelshare commented May 11, 2021

look this

const { client, xml } = require('@xmpp/client')
const debug = require('@xmpp/debug')

export default (context, inject) => {
  const xmpp = client({
    boshURL: 'https://gogo.so:7443/http-bind/',
    username: '[email protected]',
    password: '123456'
  })

  debug(xmpp, true)

  xmpp.on('error', (err) => {
    console.error(err)
  })

  xmpp.on('offline', () => {
    console.log('offline')
  })

  xmpp.on('stanza', async (stanza) => {
    if (stanza.is('message')) {
      await xmpp.send(xml('presence', { type: 'unavailable' }))
      await xmpp.stop()
    }
  })

  xmpp.on('online', async (address) => {
    // Makes itself available
    await xmpp.send(xml('presence'))

    // Sends a chat message to itself
    const message = xml(
      'message',
      { type: 'chat', to: address },
      xml('body', {}, 'hello world')
    )
    await xmpp.send(message)
  })

  xmpp.start().catch((err) => {
    console.error(err)
  })
}

result No compatible connection method found.

But I can connect normally with strophe.js
like this

import Strophe from 'strophe.js'

const conn = new Strophe.Connection('https://gogo.so:7443/http-bind/');
conn.connect([email protected],  '123456', function (status) {
    if (status === Strophe.Status.CONNECTED) {
    } else if (status === Strophe.Status.DISCONNECTED) {
    }
  });

why ?? please help me

@sonnyp
Copy link
Member

sonnyp commented May 11, 2021

xmpp.js does not support the HTTP transport method.

See https://github.com/xmppjs/xmpp.js/tree/master/packages/client#transports

@abelshare
Copy link
Author

thanks

@sonnyp
Copy link
Member

sonnyp commented Jun 18, 2021

#561

@sonnyp sonnyp closed this as completed Jun 18, 2021
@sonnyp sonnyp mentioned this issue Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants