Projects tigase _server server-core Issues #369
Add support for XMPP Sub-protocol for WebSocket (#369)
Andrzej Wójcik (Tigase) opened 1 decade ago
Due Date
2014-12-29

Right now we have support for XMPP over WebSocket as it is defined in http://www.ietf.org/archive/id/draft-moffitt-xmpp-over-websocket-04.txt but this document is replaced with new document http://tools.ietf.org/html/draft-ietf-xmpp-websocket-09. This new document is still a draft and it contains more changes to original XMPP protocol, but as it is 9th revision I think it would be safe to start implementation of support for this subprotocol.

There is an issue here - new protocol is not compatible with current implementation as current implementation uses only wrapped plain C2S protocol while this new version created new subprotocol. I'm not sure if it will be possible to have them both running on same port (or even if it would be desired as client might not know which protocol it should use if it will know both - as in case of future version of Jaxmpp2)

Andrzej Wójcik (Tigase) commented 1 decade ago

I implemented XMPP subprotocol for WebSocket as described at http://tools.ietf.org/html/draft-ietf-xmpp-websocket-10 which is next version of specification mentioned in issue description.

Everything works as it should and by default server on same port is able to handle both XMPP over WebSocket specification (http://tools.ietf.org/html/draft-ietf-xmpp-websocket-10 and http://www.ietf.org/archive/id/draft-moffitt-xmpp-over-websocket-04.txt) without any configuration. Proper version of protocol is used depending on request sent from client.

In specification it was described that XMPP over WebSocket should work if Sec-WebSocket-Protocol HTTP header contains xmpp as a value and it should report xmpp as used protocol. New implementation just as older one responds with xmpp as a value for used protocol, however new implementation also supports xmpp-framing as a protocol (and this is perfered one by implementation). This means that if client knows both versions of specification (draft-moffit and draft-ietf) but prefers to use newer one, it can send to server list containing xmpp and xmpp-framing as supported protocol and Tigase XMPP Server which supports newer version will respond with xmpp-framing as used protocol so that client will know that new version of protocol is supported. This custom feature was added to allow client to select proper protocol without trying first one and if it fails then trying to use second protocol on next connection as establishing connection could create a delay.

Artur Hefczyc commented 1 decade ago

Ok, thank you for a good work. The question however is: How can we test it in an automated way? TTS does not support web sockets yet and I wonder if it is worth the effort to add web sockets support to TTS. Maybe we could have some tests based on JaXMPP library which could cover elements not available in TTS and maybe at some point replace TTS entirely.

Andrzej Wójcik (Tigase) commented 1 decade ago

It would be possible to implement WebSocket for Jaxmpp for J2SE environment. Right now we are using in Jaxmpp2 implementation of WebSocket delivered by web browsers so we can not use this in automated tests and we would need to implement support for WebSocket in Jaxmpp2-J2SE to make it possible to add automated testing of WebSocket.

Artur Hefczyc commented 1 decade ago

As mentioned in the other ticket, I am not qualified for QA for the feature. We need automated tests in order to close these tickets.

Please share all: %bmalkow , %wojtek , %eric your ideas about automated tests. TTS seems to be working more or less but it seems to be nobody favorite tool and adding new tests or maintaining the project is a task nobody wants to do.

Maybe what we need is some kind of GUI/Web tool for creating tests for TTS? I think it would be actually easy to do so as most tests consist of simple:

  1. Send this

  2. Expect this

Andrzej Wójcik (Tigase) commented 1 decade ago

I think that to create automated tests we would need WebSocket implementation in Jaxmpp-J2SE so that we could test it at all as we need not only send data but it needs to be framed in WebSocket frames which is impossible without proper implementation of WebSocket in Jaxmpp-J2SE

Andrzej Wójcik (Tigase) commented 10 years ago

I prepared WebSocket implementation in Jaxmpp-J2SE which can be used to write automatic tests using ie. TestNG framework as we already did for some of our internal projects.

But the questions are:

Where (in which project) test should be created?

Do we have any environment for this tests to run?

Artur Hefczyc commented 10 years ago

I thought of either doing this within TTS project or creating a new project just for testing. However, I am not sure if this is the best approach. You have more experience with writing and maintaining tests for our customer so you probably have better idea how to do this best.

Maybe Wojciech, who prepared the whole framework for NP should decide.

wojciech.kapcia@tigase.net commented 10 years ago

Artur Hefczyc wrote:

Maybe Wojciech, who prepared the whole framework for NP should decide.

I would go with separate project - more clean approach, easier to maintain.

issue 1 of 1
Type
New Feature
Priority
Normal
Assignee
RedmineID
2238
Version
tigase-server-7.0.0
Estimation
25h
Spent time
63h
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#369
Please wait...
Page is in error, reload to recover