Code Monkey home page Code Monkey logo

stanza.io's Introduction

Stanza.io

Modern XMPP in the browser, with a JSON API.

Build Status Dependency Status devDependency Status

Browser Support

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.

Important Protocol Changes

Starting with v4.0.0, stanza.io is using the protocol specified in the latest XMPP over WebSocket draft by default, which contains backwards incompatible changes.

Servers have started switching to using the latest protocol; notably, Prosody's WebSocket module for prosody-0.10. If your server has not yet been upgraded, you can set transports to ['old-websocket'] in the config:

var oldws = XMPP.createClient({
    ...
    transports: ['old-websocket']
});

Installing

$ npm install stanza.io

Building bundled/minified version (for AMD, etc)

$ grunt

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

Getting Started

  1. Find or install a server which supports XMPP over WebSocket (Prosody recommended).
  2. Run grunt to build build/stanzaio.bundle.js
  3. Open demo.html in your browser
  4. Enter your connection info, click connect.
  5. Use the JS console to play with the XMPP client (var client).

If you want to see stanza.io in action in a full-featured client, take a look at Otalk.im (and its source).

Echo Client Demo

var XMPP = require('stanza.io'); // if using browserify

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

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 sarumjanuch avatar lumirayz avatar joepie91 avatar nsk-mironov avatar

Watchers

 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.