Coder Social home page Coder Social logo

stanza.io's Introduction

Stanza.io

Modern XMPP in the browser, with a JSON API.

What is this?

Stanza.io is a library for using modern XMPP in the browser, and it does that by exposing everything as JSON. Unless you insist, you have no need to ever see or touch any XML when using stanza.io.

Installing

$ npm install stanza.io

Building bundled/minified version (for AMD, etc)

First run npm install to get all of the dependencies, and then run npm run build:

$ npm install
$ npm run build

The bundled and minified files will be in the generated dist directory.

Getting Started

  1. Find or install a server which supports XMPP over WebSocket (Prosody recommended).
  2. Clone this repo with git clone https://github.com/legastero/stanza.io.git
  3. Run npm install in the new stanza.io directory.
  4. Run npm run build to create dist/stanzaio.browser.js.
  5. Open demo.html in your browser.
  6. Enter your connection info, click connect.
  7. Use the JS console to play with the XMPP client (var client).

Echo Client Demo

var XMPP = require('stanza.io');

var client = XMPP.createClient({
    jid: '[email protected]',
    password: 'hunter2',

    // If you have a .well-known/host-meta.json file for your
    // domain, the connection transport config can be skipped.

    transport: 'websocket',
    wsURL: 'wss://example.com:5281/xmpp-websocket'
    // (or `boshURL` if using 'bosh' as the transport)
});

client.on('session:started', function() {
    client.getRoster();
    client.sendPresence();
});

client.on('chat', function(msg) {
    client.sendMessage({
        to: msg.from,
        body: 'You sent: ' + msg.body
    });
});

client.connect();

Documentation

License

MIT

Created By

If you like this, follow @lancestout on twitter.

stanza.io's People

Contributors

legastero avatar fippo avatar marc0s avatar sarumjanuch avatar abdurrahmanekr avatar thesabbir avatar lumirayz avatar andrei-cacio avatar dan-lee avatar denkomanceski avatar dwilson6 avatar ilyasemenov avatar juliendangers avatar froelund avatar malakada avatar matviyiv avatar nickolaivinogradov avatar latentflip avatar raphiz avatar stefansaenger avatar suguru03 avatar joepie91 avatar nsk-mironov avatar vyacheslavas avatar wpasternak avatar greenkeeper[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.