@@ -29,6 +29,7 @@ function getParameterByName(name: string): string | null {
29
29
30
30
export interface Props {
31
31
endpoint ?: string
32
+ endpointUrl ?: string
32
33
subscriptionEndpoint ?: string
33
34
setTitle ?: boolean
34
35
settings ?: EditorSettings
@@ -91,7 +92,10 @@ class MiddlewareApp extends React.Component<Props, State> {
91
92
const { activeEnv, projectName } = this . getInitialActiveEnv ( config )
92
93
93
94
let endpoint =
94
- props . endpoint || getParameterByName ( 'endpoint' ) || location . href
95
+ props . endpoint ||
96
+ props . endpointUrl ||
97
+ getParameterByName ( 'endpoint' ) ||
98
+ location . href
95
99
96
100
let subscriptionEndpoint : string | undefined | null =
97
101
props . subscriptionEndpoint || getParameterByName ( 'subscriptionEndpoint' )
@@ -100,6 +104,8 @@ class MiddlewareApp extends React.Component<Props, State> {
100
104
const endpoints = getActiveEndpoints ( config , activeEnv , projectName )
101
105
endpoint = endpoints . endpoint
102
106
subscriptionEndpoint = endpoints . subscriptionEndpoint
107
+ } else {
108
+ subscriptionEndpoint = this . getGraphcoolSubscriptionEndpoint ( endpoint )
103
109
}
104
110
105
111
this . state = {
@@ -121,6 +127,16 @@ class MiddlewareApp extends React.Component<Props, State> {
121
127
}
122
128
}
123
129
130
+ getGraphcoolSubscriptionEndpoint ( endpoint ) {
131
+ if ( endpoint . includes ( 'api.graph.cool' ) ) {
132
+ return `wss://subscriptions.graph.cool/v1/${
133
+ endpoint . split ( '/' ) . slice ( - 1 ) [ 0 ]
134
+ } `
135
+ }
136
+
137
+ return endpoint
138
+ }
139
+
124
140
migrateSettingsString ( settingsString ) {
125
141
const replacementMap = {
126
142
theme : 'editor.theme' ,
0 commit comments