benjreinhart commented on a change in pull request #11498:
URL: https://github.com/apache/superset/pull/11498#discussion_r607297151



##########
File path: superset-websocket/src/index.ts
##########
@@ -0,0 +1,465 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import * as http from 'http';
+import * as net from 'net';
+import WebSocket from 'ws';
+import { v4 as uuidv4 } from 'uuid';
+
+const winston = require('winston');
+const jwt = require('jsonwebtoken');
+const cookie = require('cookie');
+const Redis = require('ioredis');
+
+export type StreamResult = [
+  recordId: string,
+  record: [label: 'data', data: string],
+];
+
+// sync with superset-frontend/src/components/ErrorMessage/types
+export type ErrorLevel = 'info' | 'warning' | 'error';
+export type SupersetError<ExtraType = Record<string, any> | null> = {
+  error_type: string;
+  extra: ExtraType;
+  level: ErrorLevel;
+  message: string;
+};
+
+type ListenerFunction = (results: StreamResult[]) => void;
+interface EventValue {

Review comment:
       If I'm reading this correctly, it looks like under the polling 
implementation, the response is in the format:
   
   ```typescript
   type PollingResponse = {
     result: EventValue;
   }
   ```
   
   Whereas the response here is simply:
   
   ```typescript
   type WebSocketResponse = EventValue;
   ```
   
   I'm not opinionated either way, but I think we should consider having a 
standard structure




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to