Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PubSub Issues #1479

Open
hfgn opened this issue Dec 9, 2022 · 0 comments
Open

PubSub Issues #1479

hfgn opened this issue Dec 9, 2022 · 0 comments

Comments

@hfgn
Copy link

hfgn commented Dec 9, 2022

I don't know why the subscription is not working

Mutation: {
    async test(root, args, { injector}){      
          injector.get(PubSub).publish('NUMBER_INCREMENTEDD',  {messageAdded:{id:"testsuscription"}});
    }
}


Subscription: {
    messageAdded: {
      subscribe: (root, args, { injector }) => {
          return injector.get(PubSub).asyncIterator('NUMBER_INCREMENTEDD');
      }
}

if i print the injector.get(PubSub) the result is

PostgresPubSub {
  ee: EventEmitter {
    _events: [Object: null prototype] {
      newListener: [Function (anonymous)],
      removeListener: [Function (anonymous)],
      NUMBER_INCREMENTEDD: [Function: pushValue]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    notify: [Function (anonymous)],
    send: [Function (anonymous)],
    end: [Function (anonymous)],
    [Symbol(kCapture)]: false
  },
  subscriptions: {},
  subIdCounter: 0,
  client: Client {
    _events: [Object: null prototype] { notification: [Function (anonymous)] },
    _eventsCount: 1,
    _maxListeners: undefined,
    connectionParameters: ConnectionParameters {
      user: 'testuser',
      database: 'whatsapp',
      port: 25432,
      host: 'localhost',
      password: 'testpassword',
      binary: false,
      ssl: false,
      client_encoding: '',
      replication: undefined,
      isDomainSocket: false,
      application_name: undefined,
      fallback_application_name: undefined,
      statement_timeout: false,
      idle_in_transaction_session_timeout: false,
      query_timeout: false,
      connect_timeout: 0
    },
    user: 'testuser',
    database: 'whatsapp',
    port: 25432,
    host: 'localhost',
    password: 'testpassword',
    replication: undefined,
    _Promise: [Function: Promise],
    _types: TypeOverrides { _types: [Object], text: {}, binary: {} },
    _ending: false,
    _connecting: true,
    _connected: false,
    _connectionError: false,
    _queryable: true,
    connection: Connection {
      _events: [Object: null prototype],
      _eventsCount: 14,
      _maxListeners: undefined,
      stream: [Socket],
      _keepAlive: false,
      _keepAliveInitialDelayMillis: 0,
      lastBuffer: false,
      lastOffset: 0,
      buffer: null,
      offset: null,
      encoding: 'utf8',
      parsedStatements: {},
      writer: [Object],
      ssl: false,
      _ending: false,
      _mode: 0,
      _emitMessage: false,
      _reader: [Object],
      [Symbol(kCapture)]: false
    },
    queryQueue: [ [Query] ],
    binary: false,
    processID: null,
    secretKey: null,
    ssl: false,
    _connectionTimeoutMillis: 0,
    [Symbol(kCapture)]: false
  },
  commonMessageHandler: [Function: defaultCommonMessageHandler]
}

the subscriptions: {} is empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant