theigl commented on a change in pull request #417: WICKET-6761 Multiple 
websocket connections from the same session
URL: https://github.com/apache/wicket/pull/417#discussion_r396431582
 
 

 ##########
 File path: 
wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/BaseWebSocketBehavior.java
 ##########
 @@ -93,10 +119,12 @@ public void renderHead(Component component, 
IHeaderResponse response)
                        int pageId = component.getPage().getPageId();
                        variables.put("pageId", pageId);
                        variables.put("resourceName", "");
+                       variables.put("resourceToken", "");
 
 Review comment:
   Martin: You are right! I did not test this PR yet, it was meant as a basis 
for discussion and to clarify what I'm trying to achieve. 
   
   I now added a demo page to the websocket examples at: 
http://localhost:8080/websockets
   
   It uses `UUID.randomUUID()` as a token. If you open two tabs of the new 
page, you will see that the charts are updated correctly. If you open two tabs 
of the existing demo page, the first tab will stop receiving updates because 
the connection has been overwritten.
   
   I had to make two changes to the existing demo to showcase this:
   - Increase the pool size of the scheduled executor to support multiple tabs
   - Move connection lookup in `ChartUpdater` into the loop so the connection 
is not cached but looked up every time the chart wants to push new data. Even 
though the connection was overwritten in the registry, the demo still worked 
before because `ChartUpdater` held a reference to the connection.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to