getkaiwa / kaiwa

[UNMAINTAINED] A modern XMPP Web client
http://getkaiwa.com
MIT License
1.34k stars 154 forks source link

Standalone Prosody server #9

Open warcode opened 9 years ago

warcode commented 9 years ago
Apr 08 22:34:08 c2s1bc09c0  info    Client connected
Apr 08 22:34:08 c2s1bc09c0  info    Session closed by remote with error: invalid-xml
Apr 08 22:34:08 c2s1bc09c0  info    Client disconnected: connection closed

I've ripped out LDAP, managed to npm install and get Kaiwa to run. I'm using the mod_websockets from the kaiwa-server repo, and lua-bitop is installed.

Anybody know what the issue is before I continue working on this tomorrow?

mwild1 commented 9 years ago

Could you enable debug logging in Prosody? (how to do that is generally described in the comments of the logging section in the config file)

warcode commented 9 years ago
Apr 09 15:28:18 socket  debug   server.lua: auto-starting ssl negotiation...
Apr 09 15:28:18 socket  debug   server.lua: attempting to start tls on tcp{client}: 0x1335c28
Apr 09 15:28:18 socket  debug   server.lua: accepted new client connection from xx.xx.xx.xx:55560 to 5281
Apr 09 15:28:18 socket  debug   server.lua: ssl handshake done
Apr 09 15:28:18 http.server debug   Firing event: GET x.x.io/xmpp-websocket
Apr 09 15:28:18 c2sf4d6a0   info    Client connected
Apr 09 15:28:18 mod_websocket   debug   Websocket received: <open xmlns="urn:ietf:params:xml:ns:xmpp-framing" version="1.0" xml:lang="en" to="x.x.io"/> (98 bytes)
Apr 09 15:28:18 c2sf4d6a0   debug   Client sent opening <stream:stream> to x.x.io
Apr 09 15:28:18 c2sf4d6a0   debug   Sent reply <stream:stream> to client
Apr 09 15:28:18 mod_websocket   debug   Websocket received: <error xmlns="http://etherx.jabber.org/streams"><invalid-xml xmlns="urn:ietf:params:xml:ns:xmpp-streams"/></error> (114 bytes)
Apr 09 15:28:18 mod_websocket   debug   Websocket received: <close xmlns="urn:ietf:params:xml:ns:xmpp-framing"/> (52 bytes)
Apr 09 15:28:18 c2sf4d6a0   info    Session closed by remote with error: invalid-xml
Apr 09 15:28:18 c2sf4d6a0   debug   c2s stream for <xx.xx.xx.xx> closed: session closed
Apr 09 15:28:18 c2sf4d6a0   debug   Destroying session for (unknown) ((unknown)@x.x.io)
Apr 09 15:28:18 c2sf4d6a0   info    Client disconnected: connection closed
Apr 09 15:28:18 c2sf4d6a0   debug   Destroying session for (unknown) ((unknown)@(unknown))
Apr 09 15:28:18 socket  debug   server.lua: closed client handler and removed socket from list
Apr 09 15:28:18 c2sf4d6a0   debug   Received </stream:stream>
Apr 09 15:28:18 c2sf4d6a0   debug   Attempt to close already-closed session

Its got something to do with the parsing in the client websocket implementation.

warcode commented 9 years ago

It seems stanza.io requires the 0.10 dev version of prosody to function properly without any changes.

Changing the transport to "transports: ['old-websocket']" makes it work properly.

warpfork commented 9 years ago

It looks like there's also a hacked-around patch to websocket.js in Docker/app/stanza.io/websocket.js:

        if (data.indexOf("<stream:stream") > 0 && data.indexOf("</stream:stream") == -1) {
            data += "</stream:stream>";
        }

That said,

A) it'd be nice if that part of the install would Do The Right Thing without being hidden under the docker stuff. What if I'm not using docker? B) hacking in special case support with string literal checks to compensate for a general purpose failure to (apparently) understand self-closing tags is.... uh, slightly worrisome? Seems a bit fragile.

moparisthebest commented 9 years ago

I am also trying to get this to work with a standalone prosody server, I am running 0.10 already and these are the logs I get:

Jul 01 11:41:49 socket  debug   accepted incoming client connection from: X.X.X.X 56720 to 5280 
Jul 01 11:41:49 http.server     debug   Firing event: GET example.org/xmpp-websocket/
Jul 01 11:41:49 c2s116dab0      info    Client connected
Jul 01 11:41:49 mod_websocket   debug   Websocket received frame: opcode=1, 96 bytes
Jul 01 11:41:49 c2s116dab0      debug   Client sent opening <stream:stream> to example.org
Jul 01 11:41:49 c2s116dab0      debug   Sent reply <stream:stream> to client
Jul 01 11:42:00 c2s124fd40      debug   Received[c2s]: <r xmlns='urn:xmpp:sm:3'>
Jul 01 11:42:04 c2sd2b990       debug   Handled 186 incoming stanzas
Jul 01 11:42:04 c2sd2b990       debug   Received[c2s]: <iq id='2587' type='get' to='example.org'>
Jul 01 11:42:04 c2sd2b990       debug   #queue = 1
Jul 01 11:42:04 c2sd2b990       debug   Received[c2s]: <a xmlns='urn:xmpp:sm:2' h='400'>
Jul 01 11:42:04 c2sd2b990       debug   #queue = 0
Jul 01 11:42:49 socket  debug   connection failed in read event: closed 
Jul 01 11:42:49 socket  debug   closing client with id: 11745e0 closed 
Jul 01 11:42:49 c2s116dab0      info    Client disconnected: closed
Jul 01 11:42:49 c2s116dab0      debug   Destroying session for (unknown) ((unknown)@example.org): closed

Any ideas what needs done?