From f7af904979852f491aa82ebbf8fdc7dc6c2a3688 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 12 Jun 2023 12:15:33 +0200 Subject: [PATCH] remove websocket connection from postmessage channel package --- code/lib/channel-postmessage/package.json | 1 - code/lib/channel-postmessage/src/index.ts | 11 +---------- code/yarn.lock | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/code/lib/channel-postmessage/package.json b/code/lib/channel-postmessage/package.json index 3ab776366355..c67806ac425c 100644 --- a/code/lib/channel-postmessage/package.json +++ b/code/lib/channel-postmessage/package.json @@ -43,7 +43,6 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/channel-websocket": "7.1.0-alpha.30", "@storybook/channels": "7.1.0-alpha.30", "@storybook/client-logger": "7.1.0-alpha.30", "@storybook/core-events": "7.1.0-alpha.30", diff --git a/code/lib/channel-postmessage/src/index.ts b/code/lib/channel-postmessage/src/index.ts index 5ec6a64fc856..18ef133589ff 100644 --- a/code/lib/channel-postmessage/src/index.ts +++ b/code/lib/channel-postmessage/src/index.ts @@ -2,13 +2,12 @@ import { global } from '@storybook/global'; import * as EVENTS from '@storybook/core-events'; import { Channel } from '@storybook/channels'; import type { ChannelHandler, ChannelEvent, ChannelTransport } from '@storybook/channels'; -import { WebsocketTransport } from '@storybook/channel-websocket'; import { logger, pretty } from '@storybook/client-logger'; import { isJSON, parse, stringify } from 'telejson'; import qs from 'qs'; import invariant from 'tiny-invariant'; -const { document, location, CONFIG_TYPE } = global; +const { document, location } = global; interface Config { page: 'manager' | 'preview'; @@ -299,14 +298,6 @@ const getEventSourceUrl = (event: MessageEvent) => { export function createChannel({ page }: Config): Channel { const transports: ChannelTransport[] = [new PostmsgTransport({ page })]; - if (CONFIG_TYPE === 'DEVELOPMENT') { - const protocol = window.location.protocol === 'http:' ? 'ws' : 'wss'; - const { hostname, port } = window.location; - const channelUrl = `${protocol}://${hostname}:${port}/storybook-server-channel`; - - transports.push(new WebsocketTransport({ url: channelUrl, onError: () => {} })); - } - return new Channel({ transports }); } diff --git a/code/yarn.lock b/code/yarn.lock index d18753666eb0..d965cfcff7dd 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5948,7 +5948,6 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/channel-postmessage@workspace:lib/channel-postmessage" dependencies: - "@storybook/channel-websocket": 7.1.0-alpha.30 "@storybook/channels": 7.1.0-alpha.30 "@storybook/client-logger": 7.1.0-alpha.30 "@storybook/core-events": 7.1.0-alpha.30