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

'debug' module in handlers #3

Open
pafik13 opened this issue Apr 28, 2019 · 1 comment
Open

'debug' module in handlers #3

pafik13 opened this issue Apr 28, 2019 · 1 comment

Comments

@pafik13
Copy link

pafik13 commented Apr 28, 2019

I try to use debug in handler and it's not working. How to fix it?
Code:

...
const agcBrokerClient = require('agc-broker-client');
const log = require('debug')('asyngular');   // <-- DECLARE

const ENVIRONMENT = process.env.ENV || 'dev';
...
...
...
// Asyngular/WebSocket connection handling loop.
(async () => {
  for await (let {socket} of agServer.listener('connection')) {
    // Handle socket connection.
    console.log('connect', socket);  // <-- work
    log('connect');  // <-- NOT work

    (async () => {
      // Set up a loop to handle remote transmitted events.
      for await (let data of socket.receiver('customRemoteEvent')) {
        console.log('customRemoteEvent', JSON.stringify(data));  // <-- work
        log('customRemoteEvent %o', data);  // <-- NOT work
      }
    })();
  }
})();
...
...
@jondubois
Copy link
Member

Does it work outside of the async IIFE?

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

2 participants