xmppo / node-xmpp-bosh

An XMPP BOSH & WebSocket server (connection manager) written on node.js using Javascript
https://github.com/xmppo/node-xmpp-bosh
263 stars 85 forks source link

Provide an API compatible abstraction to use node-xml as node-expat #44

Open dhruvbird opened 11 years ago

dhruvbird commented 11 years ago

https://github.com/robrighter/node-xml

This allows anyone to use it (independent of platform) since node-xml is pure javascript (no C-bindings to libexpat1).

However, this comes at a cost:

This mode would be discouraged, but hopefully supported some time in the future.

sonnyp commented 10 years ago

I don't know if it helps but ltx support different backends https://github.com/astro/ltx/tree/master/lib

node-xml is one of them

dhruvbird commented 10 years ago

ltx support different backends

Didn't know this - thanks for the info!

We use the SAX interface of node-expat, so this is of limited use for now :-/

sonnyp commented 10 years ago

What about switching to ltx?

dhruvbird commented 10 years ago

ltx doesn't have a sax parser - and it's used heavily to do the xml parsing since it's much more efficient to do that than dom parsing. Besides, it isn't easy to locate xml message boundaries when data is received over a socket from the xmpp server.

sonnyp commented 10 years ago

https://github.com/astro/ltx/tree/master/lib

Please see sax_node-xml.js

dhruvbird commented 10 years ago

@sonnyp That's an interesting starting point! nxb uses methods specific to node-expat (such as getCurrentByteIndex) which are used to limit the buffer size and prevent buffer-build-up attacks against the bosh proxy. It would be possible to build a failure mode that doesn't support these features and lacks these functions, but I don't see too many people asking for a windows build. While it would be super to have something that works, it feels that having something that works and is performant and has all the required features might be a stretch in the near term :-/