Skip to content

Remove websockets usage in cdap-ui - #1428

Open
GnsP wants to merge 1 commit into
cdapio:developfrom
GnsP:feature/remove-websockets
Open

Remove websockets usage in cdap-ui#1428
GnsP wants to merge 1 commit into
cdapio:developfrom
GnsP:feature/remove-websockets

Conversation

@GnsP

@GnsP GnsP commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Remove websockets usage in cdap-ui

PR Type

  • Bug Fix
  • Feature
  • Build Fix
  • Testing
  • General Improvement
  • Cherry Pick

Links

Jira: Jira issue #

Test Plan

Screenshots

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the custom WebSocket-based data source implementation (including MyDataSource, MyCDAPDataSource, mySocket, and the backend Aggregator) and transitions the application to use standard HTTP requests via $http. Feedback on these changes highlights a few critical issues: removing the WebSocket and data source modules has left behind orphaned references to MyDataSourceProvider and MYSOCKET_EVENT in app/hydrator/main.js which will cause runtime errors, and has also left unused imports and helper functions in server.js that should be cleaned up.

Comment thread app/hydrator/main.js
* setting the className based events from $state and caskTheme
*/
.controller('BodyCtrl', function ($scope, $cookies, $cookieStore, caskTheme, CASK_THEME_EVENT, $rootScope, $state, $log, MYSOCKET_EVENT, MyCDAPDataSource, MY_CONFIG, MYAUTH_EVENT, EventPipe, myAuth, $window, myAlertOnValium, myLoadingService, myHelpers, $http) {
.controller('BodyCtrl', function ($scope, $cookies, $cookieStore, caskTheme, CASK_THEME_EVENT, $rootScope, $state, $log, MY_CONFIG, MYAUTH_EVENT, EventPipe, myAuth, $window, myAlertOnValium, myLoadingService, myHelpers, $http) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Removing MYSOCKET_EVENT and MyCDAPDataSource from the controller dependencies is correct, but there are two remaining references in this file that will now cause runtime errors:

  1. MyDataSourceProvider Configuration (Lines 91-93):
.config(function (MyDataSourceProvider) {
  MyDataSourceProvider.defaultInterval = 5;
})

Since MyDataSource has been completely removed (from datasource.js), configuring MyDataSourceProvider here will throw an AngularJS injector error on startup. This block should be removed.

  1. MYSOCKET_EVENT Event Listener (Lines 301-304):
EventPipe.on(MYSOCKET_EVENT.reconnected, function () {
  $log.log('[DataSource] reconnected.');
  myLoadingService.hideLoadingIcon();
});

Since MYSOCKET_EVENT is no longer injected or defined, referencing it here will throw a ReferenceError at runtime. This event listener should be removed.

Comment thread server.js
});
function gracefulShutdown() {
log.info('Caught SIGTERM. Closing http & ws server');
log.info('Caught SIGTERM. Closing http server');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since the WebSocket upgrade listener has been removed, the helper function getAuthHeaderFromRawCookies (lines 52-57) and the cookie import (line 22) are no longer used anywhere in server.js.

Please remove them to keep the codebase clean and avoid dead code:

  • import cookie from 'cookie'; (line 22)
  • getAuthHeaderFromRawCookies function definition (lines 52-57)

@GnsP GnsP added the build triggers github action label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build triggers github action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant