npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-bosh-xmpp-client

v0.1.5

Published

XMPP clients that connects via BOSH

Downloads

61

Readme

node-bosh-xmpp

Motivation

Are you using node-xmpp for XMPP? But get blocked by coorperate firewalls? Then node-bosh-xmpp is API compatible with node-xmpp and gives you the ability to use XMPP over a standard HTTP port.

Credits go to Anoopc

I was looking for a BOSH XMPP client for node and came accross Anoop's node-xmpp-via-bosh implementation. His code was not completely working for me so I forked his code and fixed the issue I was having. I wanted to be able to specify the URL of the BOSH server and I also had some issues with the authorization proces.

Installation instructions

npm install node-bosh-xmpp-client

Code instructions

Following you will find the documentation from Anoop which I updated to reflect my changes:

It is inspired by node-xmpp (https://github.com/astro/node-xmpp) and xmppjs(http://github.com/mwild1/xmppjs) and it is API compatible with node-xmpp (except for the constructor).

It is an xmpp library which lets you establish a persistent session to xmpp server via a bosh-server and communicate willingly.

Documentation for API

  • Constructor: Client(jid, password, bosh, route)

      Parameters:  
    
          *jid*       : [String] jabber id of user (e.g. `[email protected]/office`)  
          *password*  : [String] password  
          *bosh*      : [String] url of the bosh-server (e.g. `http://localhost:5280/http-bind/`)  
          *route*     : [String] route attribute [if used] for connecting to xmpp server  
      Return Value:  
    
          new Client Object having following properties:  
    1. Event-emitter for the following events

      online Event-listener: function callback()

      error Event-listener: function callback(exception)

       `exception[String]` is the description of error

      offline Event-listener: function callback(condition)

       `condition[String]` is the description of reason for being offline

      stanza Event-listener: function callback(stanza)

       `stanza[Object]` is the ltx xml element.
    2. Function: send(stanza)

      enqueues the stanza into the pending array to be sent to bosh-server on next Tick parameters:

       *stanza* : [Object] ltx xml Element object
    3. Function: sendMessage(to, body, type = "chat")

      sends a message 'body' to jid 'to' with type set to 'type'

      parameters:

       *to*   : [String] jid of receiver(e.g. `[email protected]/home`)
       *body* : [String] message to be sent
       *type* : [String] should only be among the permitted values of `type` for xmpp message stanza
    4. Function: disconnect()

      sends immediately any pending stanzas, ends the stream by sending terminate packet.

  • Constructor Element(xname, attrs)

      alias to `ltx.Element` Constructor
  • Function: $build(xname, attrs)

      an alias for `new ltx.Element(xname, attrs)`
    
      Parameters:
    
      	*xname* : [string] name for the xml element
      	*attrs* : [Object] containing all the attributes to set up
    
      Return value:
    
      	a new ltx.Element object
  • Function: $msg(attrs)

      an alias for `new ltx.Element("message", attrs)`
    
      Parameters:
    
      	*attrs* : [Object] containing all the attributes to set up
    
      Return value:
    
      	a new ltx.Element object
  • Function: $iq(attrs)

      an alias for `new ltx.Element("iq", attrs)`
    
      Parameters:
    
      	attrs : [Object] containing all the attributes to set up
    
      Return value:
    
      	a new ltx.Element object
  • Function: $pres(attrs)

      an alias for `new ltx.Element("presence", attrs)`
    
      Parameters:
    
      	*attrs* : [Object] containing all the attributes to set up
    
      Return value:
    
      	a new ltx.Element object

    Function: setNoMoreResponse() Artificially set the OVER state in order to no longer answer or send on this connection. This is useful if you are taking the rid/jid/sid to another connection and need this one to stop being 'active' at that time.

  • Function: setLogLevel(logLevel)

      sets the logLevel for module (use only when in serious problem i.e. debug mode).
    
      Parameters:
    
      	*logLevel* : [String] permissible values:
    
      	       *FATAL*	:	displays nothing [default]
      		   *ERROR*	:	displays error messages
      		   *INFO*	:	informs about important events
      		   *DEBUG*	:	prints each packet sent and received

Shout outs

Shout outs go to the Webinos project. They provided the time and need to make this fix.