Skip to content

How to trigger side effect after subscribe to channel? #281

@eisuf

Description

@eisuf

Hello. How i can achieve this right after I subscribe to trigger a callback function that will f.ex do a api-request to some endpoint?

So I have this like this:
Subscription: { myQuery: { subscribe: ()=>pubsub.asyncIterator(channelId);, resolve: (payload: myType) => { return payload }, }, },

I would like right after I register/subscribe to channel to trigger it so somehow after
pubsub.asyncIterator(channelId) this line runs. I tried some hacky solution with setTimeout but that is not good one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions