src/index.js
/*
    Send events as CloudEvent JSON.
    See also: https://github.com/cloudevents/spec/blob/master/json-format.md
   */
Send events as CloudEvent JSON.
Send events as CloudEvent JSON .
_sendEvent(node, eventName, eventData) {
    return request.post(node.endpoint, {
      json: {
        eventType: eventName,
        type: 'com.microservices.node.template',
        specversion: '0.2',
        source: '/my-source',
        id: `NODE-TEMPLATE-${this._nrSentEvents++}`,
        time: (new Date()).toISOString(),
        datacontenttype: 'application/json',
        data: eventData,
      }
    });
  }
_sendEvent ( node , eventName , eventData ) { return request . post ( node . endpoint , { json : { eventType : eventName , type : 'com.microservices.node.template' , specversion : '0.2' , source : '/my-source' , id : ` ${ this . _nrSentEvents ++ } ` , time : ( new Date ( ) ) . toISOString ( ) , datacontenttype : 'application/json' , data : eventData , } } ) ; }
Send events as CloudEvent JSON.
Send events as CloudEvent JSON .