How to use @cubejs-client/ws-transport - 1 common examples

To help you get started, we’ve selected a few @cubejs-client/ws-transport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cube-js / cube.js / examples / real-time-dashboard / dashboard-app / src / App.js View on Github external
import "./App.css";
import { Layout } from "antd";
import cubejs from "@cubejs-client/core";
import { CubeProvider } from "@cubejs-client/react";
import Header from "./components/Header";
import WebSocketTransport from "@cubejs-client/ws-transport";
import tracker from "./tracker";
const CUBEJS_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NzM2MjI5MjR9.iD_sSpXRBQSO0ywh5zSPHpHV-1O37oQMakrkG03kR-o";
let WS_URL;
if (process.env.NODE_ENV === 'production') {
  WS_URL = window.location.origin.replace('http', 'ws').replace('https', 'wss')
} else {
  WS_URL = "ws://localhost:4000/"
}
const cubejsApi = cubejs({
  transport: new WebSocketTransport({
    authorization: CUBEJS_TOKEN,
    apiUrl: WS_URL
  })
});

const AppLayout = ({ children }) => (
  
    <header>
    {children}
  
);
</header>

@cubejs-client/ws-transport

Cube.js WebSocket transport

MIT
Latest version published 2 months ago

Package Health Score

93 / 100
Full package analysis

Popular @cubejs-client/ws-transport functions

Similar packages