Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
changes in websocket connection logic to pass on headers #275
Prior to this change websockets were not working with zlux - in particular the TN3270 app which utilizes websockets to communicate with the backend. What I've done here is pass on the handshake headers which are given from the client to the api-layer onto the backend server with which we're communicating.
The other problem that I fixed here was the service paths. The hard coded service.getServiceUrl() + "/" was yielding a url that looked like ws://localhost:8544//ZLUX/plugins/... The two slashes after the port were causing issues because the service.getServiceUrl() yielded a single slash. In my change I test to see if the last character of the service.getServiceUrl() is a slash and if not append one. Otherwise I just use the serviceUrl as is.
This fixed the issue with the TN3270 app in zlux and is the last piece of the puzzle in the api-layer and zlux integration for now.
Signed-off-by: Reet Chowdhary firstname.lastname@example.org
@@ Coverage Diff @@ ## master #275 +/- ## ========================================= Coverage 68.47% 68.47% Complexity 12 12 ========================================= Files 231 231 Lines 4466 4466 Branches 561 561 ========================================= Hits 3058 3058 Misses 1259 1259 Partials 149 149
thank you for making the change and fixing the problem with the invalid path too.
The Codecov.io plugin complains that the new code is not covered by unit tests. Since we do not take coverage for integrations tests that are used for WebSockets, we do not need to follow it strictly.
I think that you have tested manually using other WebSocket clients.
It would be good to have the test for headers automated and included in the integration tests - https://github.com/zowe/api-layer/blob/master/integration-tests/src/test/java/com/ca/mfaas/ws/WebSocketProxyTest.java