GithubHelp home page GithubHelp logo

iperity / node-strophe Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 12.0 40 KB

[?] A Node.js compatible version of Strophe.js, borrowed from https://github.com/dhruvbird/node-xmpp-bosh.

JavaScript 100.00%

node-strophe's People

Contributors

tijszwinkels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-strophe's Issues

$ is not defined

I have installed the node-strophe package within my NodeBB website. However I get an error '$ is not defined' even if I just include the following line of code :
var strophe = require("node-strophe");
OR
var strophe = require("node-strophe").Strophe;

Can anyone help me resolve this issue ?

node-strophe will not compile under V4 or V5

contextify is no longer a dependency in jsdom, because it's built in to node. Also and does not even compile nan (which contextify depends on) unless people have c++11.

I would appreciate it if you could update node-strophe package to use the latest jsdom? Thanks

Strophe.connection.sendPresence not there

I tried to make my own branch and do a pull request but I am not authorized apparently. Just paste this code above sendIQ please:

/** Function: sendPresence
* Helper function to send presence stanzas. The main benefit is for
* sending presence stanzas for which you expect a responding presence
* stanza with the same id (for example when leaving a chat room).
*
* Parameters:
* (XMLElement) elem - The stanza to send.
* (Function) callback - The callback function for a successful request.
* (Function) errback - The callback function for a failed or timed
* out request. On timeout, the stanza will be null.
* (Integer) timeout - The time specified in milliseconds for a
* timeout to occur.
*
* Returns:
* The id used to send the presence.
*/
sendPresence: function(elem, callback, errback, timeout) {
var timeoutHandler = null;
var that = this;
if (typeof(elem.tree) === "function") {
elem = elem.tree();
}
var id = elem.getAttribute('id');
if (!id) { // inject id if not found
id = this.getUniqueId("sendPresence");
elem.setAttribute("id", id);
}

    if (typeof callback === "function" || typeof errback === "function") {
        var handler = this.addHandler(function (stanza) {
            // remove timeout handler if there is one
            if (timeoutHandler) {
                that.deleteTimedHandler(timeoutHandler);
            }
            var type = stanza.getAttribute('type');
            if (type === 'error') {
                if (errback) {
                    errback(stanza);
                }
            } else if (callback) {
                callback(stanza);
            }
        }, null, 'presence', null, id);

        // if timeout specified, set up a timeout handler.
        if (timeout) {
            timeoutHandler = this.addTimedHandler(timeout, function () {
                // get rid of normal handler
                that.deleteHandler(handler);
                // call errback on timeout with null stanza
                if (errback) {
                    errback(null);
                }
                return false;
            });
        }
    }
    this.send(elem);
    return id;
},

wss Protocol not supported

var c = new Strophe.Connection("wss://example.com/websocket/");
c.connect(jid, pass);

This error comes out and I cannot find a way to fix it.

Error: Protocol not supported.
    at send (/Users/jonathan/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:299:15)
    at sendFunc (/Users/jonathan/node_modules/node-strophe/strophe.js:2218:25)
    at Object._processRequest (/Users/jonathan/node_modules/node-strophe/strophe.js:2229:17)
    at Object._throttledRequestHandler (/Users/jonathan/node_modules/node-strophe/strophe.js:2266:18)
    at Object.connect (/Users/jonathan/node_modules/node-strophe/strophe.js:1648:14)
    at repl:1:12
    at sigintHandlersWrap (vm.js:22:35)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInThisContext (vm.js:21:12)
    at REPLServer.defaultEval (repl.js:313:29)

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.