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

Not getting data on subscribe channel #24

Closed
niciqy opened this issue Aug 9, 2020 · 4 comments
Closed

Not getting data on subscribe channel #24

niciqy opened this issue Aug 9, 2020 · 4 comments

Comments

@niciqy
Copy link

niciqy commented Aug 9, 2020

Hi,

I need some help - I am not getting any data on my subscribe channel. Using a Java implementation, I am receiving data from the channel. Am I doing something wrong here?

Code:

var logger = bunyan.createLogger({name: 'example'});

cometd.configure({
    appendMessageTypeToURL: false,
    url: 'https://hostcom/cometd/43.0',
    logLevel: 'debug'
});

// Handshake with the server.
cometd.handshake(function(h) {
    if (h.successful) {
        // Subscribe to receive messages from the server.
        cometd.subscribe('/data/ChangeEvents', function(m) {
            var dataFromServer = m.data;
            logger.info(dataFromServer);
            // Use dataFromServer.
        });
    }
});

Logs:

sync: false,
  messages:
   [ { id: '4',
       channel: '/meta/connect',
       connectionType: 'long-polling',
       clientId: 'tfssnqjqzpah92thxxi22qnqzd',
       timestamp: 'Sun, 09 Aug 2020 14:32:18 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
00:32:18.218 Transport long-polling waiting at most 120000 ms for the response, maxNetworkDelay 10000
00:32:18.218 Status connecting -> connected
00:32:19.038 Transport long-polling received response [{"clientId":"tfssnqjqzpah92thxxi22qnqzd","channel":"/meta/subscribe","id":"2","subscription":"/data/ChangeEvents","successful":true}]
00:32:19.038 Received [ { clientId: 'tfssnqjqzpah92thxxi22qnqzd',
    channel: '/meta/subscribe',
    id: '2',
    subscription: '/data/ChangeEvents',
    successful: true } ]
@sbordet
Copy link
Member

sbordet commented Aug 9, 2020

The logs you report show that the subscription with the server was successful.
There should be other logs that show that a /meta/connect was sent to the server and held.
Please post all the logs, not just some part.

Having timeout=120000 ms is quite a large value, you typically want to stay in the tens of seconds, rather than in the hundreds.

@niciqy
Copy link
Author

niciqy commented Aug 10, 2020

The full log

14:01:11.165 Transport websocket reset initial
14:01:11.168 Transport long-polling reset initial
14:01:11.168 Transport callback-polling reset initial
14:01:11.168 New advice { timeout: 60000, interval: 0, maxInterval: 0 }
14:01:11.169 Transport websocket accept, supported: true
14:01:11.169 Initial transport is long-polling
14:01:11.169 Status disconnected -> handshaking
14:01:11.169 Handshake sent { id: '1',
  version: '1.0',
  minimumVersion: '1.0',
  channel: '/meta/handshake',
  supportedConnectionTypes: [ 'long-polling', 'callback-polling' ],
  advice: { timeout: 60000, interval: 0 } }
14:01:11.170 Send { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '1',
       version: '1.0',
       minimumVersion: '1.0',
       channel: '/meta/handshake',
       supportedConnectionTypes: [Array],
       advice: [Object],
       timestamp: 'Mon, 10 Aug 2020 04:01:11 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:11.170 Transport long-polling sending request 1 envelope { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '1',
       version: '1.0',
       minimumVersion: '1.0',
       channel: '/meta/handshake',
       supportedConnectionTypes: [Array],
       advice: [Object],
       timestamp: 'Mon, 10 Aug 2020 04:01:11 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:11.199 Transport long-polling waiting at most 10000 ms for the response, maxNetworkDelay 10000
14:01:11.963 Transport long-polling received response [{"ext":{"replay":true,"payload.format":true},"minimumVersion":"1.0","clientId":"1jg1p8sutxsl8dcp1ueku40wlnsj8","supportedConnectionTypes":["long-polling"],"channel":"/meta/handshake","id":"1","version":"1.0","successful":true}]
14:01:11.964 Received [ { ext: { replay: true, 'payload.format': true },
    minimumVersion: '1.0',
    clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
    supportedConnectionTypes: [ 'long-polling' ],
    channel: '/meta/handshake',
    id: '1',
    version: '1.0',
    successful: true } ]
{"name":"cdc_example","hostname":"Corines-MacBook-Pro.local","pid":4391,"level":30,"ext":{"replay":true,"payload.format":true},"minimumVersion":"1.0","clientId":"1jg1p8sutxsl8dcp1ueku40wlnsj8","supportedConnectionTypes":["long-polling"],"channel":"/meta/handshake","id":"1","version":"1.0","successful":true,"reestablish":false,"msg":"","time":"2020-08-10T04:01:11.965Z","v":0}
14:01:11.965 Adding subscription on /data/ChangeEvents with scope undefined and callback function(m) {
            var dataFromServer = m.data;
            console.log(dataFromServer);
            logger.info(server_data);
            // Use dataFromServer.
        }
14:01:11.966 Added subscription { id: 1,
  channel: '/data/ChangeEvents',
  scope: undefined,
  callback: [Function],
  listener: false }
14:01:11.966 Send { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '2',
       channel: '/meta/subscribe',
       subscription: '/data/ChangeEvents',
       clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
       timestamp: 'Mon, 10 Aug 2020 04:01:11 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:11.966 Transport long-polling sending request 2 envelope { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '2',
       channel: '/meta/subscribe',
       subscription: '/data/ChangeEvents',
       clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
       timestamp: 'Mon, 10 Aug 2020 04:01:11 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:11.967 Transport long-polling waiting at most 10000 ms for the response, maxNetworkDelay 10000
14:01:11.968 Status handshaking -> connecting
14:01:11.968 Function scheduled in 0 ms, interval = 0 backoff = 0 function() {
                _connect();
            }
14:01:11.969 Invoking timed function function() {
                _connect();
            }
14:01:11.970 Connect sent { id: '3',
  channel: '/meta/connect',
  connectionType: 'long-polling',
  advice: { timeout: 0 } }
14:01:11.970 Send { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '3',
       channel: '/meta/connect',
       connectionType: 'long-polling',
       advice: [Object],
       clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
       timestamp: 'Mon, 10 Aug 2020 04:01:11 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:11.970 Transport long-polling /meta/connect send, request 3 envelope { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '3',
       channel: '/meta/connect',
       connectionType: 'long-polling',
       advice: [Object],
       clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
       timestamp: 'Mon, 10 Aug 2020 04:01:11 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:11.970 Transport long-polling sending request 3 envelope { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '3',
       channel: '/meta/connect',
       connectionType: 'long-polling',
       advice: [Object],
       clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
       timestamp: 'Mon, 10 Aug 2020 04:01:11 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:11.971 Transport long-polling waiting at most 70000 ms for the response, maxNetworkDelay 10000
14:01:11.971 Status connecting -> connected
14:01:12.121 Transport long-polling received response [{"clientId":"1jg1p8sutxsl8dcp1ueku40wlnsj8","advice":{"interval":0,"timeout":110000,"reconnect":"retry"},"channel":"/meta/connect","id":"3","successful":true}]
14:01:12.121 Transport long-polling /meta/connect complete, request 3
14:01:12.122 Received [ { clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
    advice: { interval: 0, timeout: 110000, reconnect: 'retry' },
    channel: '/meta/connect',
    id: '3',
    successful: true } ]
14:01:12.122 New advice { timeout: 110000,
  interval: 0,
  maxInterval: 0,
  reconnect: 'retry' }
14:01:12.122 Status connected -> connecting
14:01:12.122 Function scheduled in 0 ms, interval = 0 backoff = 0 function() {
                _connect();
            }
14:01:12.123 Invoking timed function function() {
                _connect();
            }
14:01:12.123 Connect sent { id: '4',
  channel: '/meta/connect',
  connectionType: 'long-polling' }
14:01:12.123 Send { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '4',
       channel: '/meta/connect',
       connectionType: 'long-polling',
       clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
       timestamp: 'Mon, 10 Aug 2020 04:01:12 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:12.123 Transport long-polling /meta/connect send, request 4 envelope { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '4',
       channel: '/meta/connect',
       connectionType: 'long-polling',
       clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
       timestamp: 'Mon, 10 Aug 2020 04:01:12 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:12.123 Transport long-polling sending request 4 envelope { url: 'https://<host>/cometd/43.0',
  sync: false,
  messages:
   [ { id: '4',
       channel: '/meta/connect',
       connectionType: 'long-polling',
       clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
       timestamp: 'Mon, 10 Aug 2020 04:01:12 GMT' } ],
  onSuccess: [Function: onSuccess],
  onFailure: [Function: onFailure] }
14:01:12.124 Transport long-polling waiting at most 120000 ms for the response, maxNetworkDelay 10000
14:01:12.124 Status connecting -> connected
14:01:12.450 Transport long-polling received response [{"clientId":"1jg1p8sutxsl8dcp1ueku40wlnsj8","channel":"/meta/subscribe","id":"2","subscription":"/data/ChangeEvents","successful":true}]
14:01:12.450 Received [ { clientId: '1jg1p8sutxsl8dcp1ueku40wlnsj8',
    channel: '/meta/subscribe',
    id: '2',
    subscription: '/data/ChangeEvents',
    successful: true } ]

@sbordet
Copy link
Member

sbordet commented Aug 10, 2020

These logs only show up to the second /meta/connect, and all is normal.
The system could be idle because there are no events to report from the server.

You need to show that you have sent a message from the server and whether this is received by the client or not.

@sbordet
Copy link
Member

sbordet commented Dec 7, 2021

This issue has been closed due to no activity.

@sbordet sbordet closed this as completed Dec 7, 2021
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