-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
113 changed files
with
1,001 additions
and
772 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ node_modules/ | |
**/dist/*.js | ||
bundle.js | ||
package.json | ||
.yarn/ | ||
server/prosody-modules/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,13 @@ | ||
/* eslint-disable node/no-extraneous-require */ | ||
|
||
'use strict' | ||
|
||
const {client, xml} = require('@xmpp/client') | ||
const {client, xml, jid} = require('@xmpp/client') | ||
const debug = require('@xmpp/debug') | ||
|
||
const xmpp = client({ | ||
service: 'ws://localhost:5280/xmpp-websocket', | ||
domain: 'localhost', | ||
resource: 'example', | ||
service: 'xmpp://jabberfr.org:5222', | ||
resource: 'myResource', | ||
username: 'username', | ||
password: 'password', | ||
}) | ||
|
||
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 => { | ||
console.log('online as', address.toString()) | ||
|
||
// 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(console.error) | ||
xmpp.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.