After some time spent on the code of websocket integration I came to the same conclusions you expressed in point 1 and 2. However it's not completely clear to me how a message can be broadcast by a session and received by another one. Can you provide and example?
Hi,

I'm looking at the implementation of the native websocket support. I see that mehod broadcastMessage of class AbstractWebSocketProcessor exports the thread local variables before broadcasting the message. Why we need to do this? Why can't we use the current variables (session, request cycle, etc...)?

Three reasons:
1) In many cases they have to be set since the broadcast can be called from non-wicket and non-servlet code. 2) in many cases broadcasting is only deadlock safe through a queue and thread pool, in which case the threads will again not have any wicket threadlocals set 3) when you broadcast a message (for example from ajax request) it is often delivered to another session. when invoking component callbacks in another session it would be confusing (or even a security problem) for the called code to see the actual initiator session stuff

But I'm interested in hearing if you have a use case where having the original session, etc available for the event handlers would be useful?

-Mikko

Reply via email to