Skip to content

Commit

Permalink
remove websocket connection from postmessage channel package
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Jun 12, 2023
1 parent dd2d339 commit f7af904
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion code/lib/channel-postmessage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 1 addition & 10 deletions code/lib/channel-postmessage/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 });
}

Expand Down
1 change: 0 additions & 1 deletion code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f7af904

Please sign in to comment.