Skip to content

Commit

Permalink
fix subscriptions url resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed May 10, 2018
1 parent f28c9f4 commit 7968cd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class PlaygroundWrapper extends React.Component<
}`
}

return endpoint
return endpoint.replace(/^http/, 'ws')
}

componentWillReceiveProps(nextProps: PlaygroundWrapperProps & ReduxProps) {
Expand Down Expand Up @@ -253,7 +253,9 @@ class PlaygroundWrapper extends React.Component<
activeEnv.projectName,
)
const endpoint = endpoints.endpoint
const subscriptionEndpoint = endpoints.subscriptionEndpoint
const subscriptionEndpoint =
endpoints.subscriptionEndpoint ||
this.normalizeSubscriptionUrl(endpoint, endpoints.subscriptionEndpoint)
const headers = endpoints.headers
this.setState({
endpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ export const defaultLinkCreator = (
return { link: httpLink }
}

const finalSubscriptionsEndpoint = wsEndpoint || subscriptionEndpoint

const subscriptionClient = new SubscriptionClient(
wsEndpoint || subscriptionEndpoint,
finalSubscriptionsEndpoint,
{
timeout: 20000,
lazy: true,
Expand Down

0 comments on commit 7968cd3

Please sign in to comment.