How to use the nats.SECURE_CONN_REQ function in nats

To help you get started, we’ve selected a few nats examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hemerajs / hemera / packages / hemera / lib / constants.js View on Github external
* Copyright 2016-present, Dustin Deus (deusdustin@gmail.com)
 * All rights reserved.
 *
 * This source code is licensed under the MIT-style license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */
const NATS = require('nats')

module.exports = {
  // General
  NATS_QUEUEGROUP_PREFIX: 'queue',
  // NATS conn error codes
  NATS_CONN_ERROR_CODES: [
    NATS.CONN_ERR,
    NATS.SECURE_CONN_REQ,
    NATS.NON_SECURE_CONN_REQ,
    NATS.CLIENT_CERT_REQ
  ],
  // NATS errors
  NATS_TRANSPORT_ERROR: 'Could not connect to NATS!',
  NATS_TRANSPORT_CLOSED: 'NATS connection closed!',
  NATS_TRANSPORT_CONNECTED: 'Connected!',
  NATS_PERMISSION_ERROR: 'NATS permission error',
  NATS_TRANSPORT_RECONNECTING: 'NATS reconnecting ...',
  NATS_TRANSPORT_RECONNECTED: 'NATS reconnected!',
  NATS_TRANSPORT_DISCONNECTED: 'NATS disconnected!',
  // Hemera request types
  REQUEST_TYPE_PUBSUB: 'pubsub',
  REQUEST_TYPE_REQUEST: 'request',
  // Application errors
  TOPIC_SID_REQUIRED_FOR_DELETION: 'Topic or sid is required for deletion',
github hemerajs / hemera / packages / hemera / lib / index.js View on Github external
const NatsTransport = require('./transport')
const DefaultExtensions = require('./extensions')
const DefaultEncoder = require('./encoder')
const DefaultDecoder = require('./decoder')
const ServerResponse = require('./serverResponse')
const ServerRequest = require('./serverRequest')
const ClientRequest = require('./clientRequest')
const ClientResponse = require('./clientResponse')
const ConfigScheme = require('./configScheme')
const Reply = require('./reply')
const Add = require('./add')
const ExtensionManager = require('./extensionManager')
const { sChildren, sRegisteredPlugins, sReplySent } = require('./symbols')
const { serverExtIterator, clientExtIterator } = require('./extensionRunner')

const natsConnCodes = [NATS.CONN_ERR, NATS.SECURE_CONN_REQ, NATS.NON_SECURE_CONN_REQ, NATS.CLIENT_CERT_REQ]

/**
 * @class Hemera
 */
class Hemera {
  /**
   * Creates an instance of Hemera
   *
   * @param {Nats} transport
   * @param {Config} params
   *
   * @memberOf Hemera
   */
  constructor(transport, params) {
    const config = Joi.validate(params || {}, ConfigScheme)
    if (config.error) {

nats

Node.js client for NATS, a lightweight, high-performance cloud native messaging system

Apache-2.0
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis