xuezier / egg-apollo-client

16 stars 6 forks source link

how to receive watch result #22

Closed imapolaris closed 3 years ago

imapolaris commented 3 years ago

i config watch:true, timeout:5. but i dont know whether they worked. how can i receive the long polling result?

xuezier commented 3 years ago

try it in beforeStart

apollo.on('config.updated', (data: IApolloReponseConfigData) => {
    // do something here
})

interface IApolloReponseConfigData {
    // '{"appId":"ums-local","cluster":"default","namespaceName":"application","configurations":{"NODE_ENV":"production"}
    appId: string;
    cluster: string;
    namespaceName: string;
    configurations: {
        [x: string]: string;
    };
    releaseKey: string;
}
imapolaris commented 3 years ago

try it in beforeStart

apollo.on('config.updated', (data: IApolloReponseConfigData) => {
    // do something here
})

interface IApolloReponseConfigData {
    // '{"appId":"ums-local","cluster":"default","namespaceName":"application","configurations":{"NODE_ENV":"production"}
    appId: string;
    cluster: string;
    namespaceName: string;
    configurations: {
        [x: string]: string;
    };
    releaseKey: string;
}

thx, it works.