Question

Section 6.3.6.4 and the bottom of section 7.2 of the CometD documentation discuss how to establish a Listener on the /meta/handshake channel to map user IDs to ServerSessions/ServerSession IDs for use in private messaging. However, when listening on the /meta/handshake channel, the ServerSession received is null, so there is no way to create the map. Any thoughts?

UPDATE:

My assumption at this point is that the HandshakeHandler Listener (added to the /meta/handshake channel in the initializeMetaChannels method of BayeuxServerImpl.java) is getting invoked after or at the same time as the custom Listener that I have created on the same channel. Since the HandshakeHandler is what actually creates the ServerSession, this results in my custom Listener receiving a null ServerSession. This is supported by the fact that the BayeuxServer SecurityPolicy's canHandshake method, which gets invoked by the HandshakeHandler after it creates the ServerSession, is getting invoked after my custom listener. I presume that the CometD documentation stating that a ServerSession to UserID map can be constructed from within a /meta/handshake Listener is in error.

Was it helpful?

Solution

Your updated analysis is correct.
The documentation should be updated, since the first point where the session will be available is in SecurityPolicy.canHandshake().
I tracked this issue with http://bugs.cometd.org/browse/COMETD-522.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top