How to use @feathersjs/socketio - 9 common examples

To help you get started, we’ve selected a few @feathersjs/socketio 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 feathers-plus / generator-feathers-plus / test / ts-cumulative-1-mongoose.test-expected / src1 / app.ts View on Github external
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
app.use(compress());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// Host the public folder
app.use('/', express.static(app.get('public')));
// !code: use_end // !end

// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest());
app.configure(socketio());

// Configure database adapters
app.configure(mongoose);

// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// Set up our services (see `services/index.ts`)
app.configure(services);
// Set up event channels (see channels.ts)
app.configure(channels);
// !code: config_middle // !end

// Configure a middleware for 404s and the error handler
app.use(express.notFound());
github feathers-plus / generator-feathers-plus / test / ts-cumulative-2-sequelize-services.test-expected / src1 / app.ts View on Github external
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
app.use(compress());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// Host the public folder
app.use('/', express.static(app.get('public')));
// !code: use_end // !end

// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest());
app.configure(socketio());

// Configure database adapters
app.configure(sequelize);

// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// Set up our services (see `services/index.ts`)
app.configure(services);
// Set up event channels (see channels.ts)
app.configure(channels);
// !code: config_middle // !end

// Configure a middleware for 404s and the error handler
app.use(express.notFound());
github feathers-plus / generator-feathers-plus / test-expands / ts-cumulative-1-mongoose.test-expected / src1 / app.ts View on Github external
// ! code: use_favicon
// Use favicon
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// !end
// ! code: use_static
// Host the public folder
app.use('/', express.static(app.get('public')));
// !end
// !code: use_end // !end

// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest(
  // !code: express_rest // !end
));
app.configure(socketio(
  // !code: express_socketio // !end
));
// Configure database adapters
app.configure(mongoose);

// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// Set up our services (see `services/index.ts`)
app.configure(services);
// Set up event channels (see channels.ts)
app.configure(channels);
// !code: config_middle // !end

// Configure a middleware for 404s and the error handler
github feathers-plus / generator-feathers-plus / test / ts-cumulative-1-memory.test-expected / src1 / app.ts View on Github external
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
app.use(compress());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// Host the public folder
app.use('/', express.static(app.get('public')));
// !code: use_end // !end

// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest());
app.configure(socketio());


// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// Set up our services (see `services/index.ts`)
app.configure(services);
// Set up event channels (see channels.ts)
app.configure(channels);
// !code: config_middle // !end

// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
// !code: config_end // !end
github feathers-plus / generator-feathers-plus / test-expands / ts-cumulative-2-sequelize-services.test-expected / src1 / app.ts View on Github external
// ! code: use_favicon
// Use favicon
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// !end
// ! code: use_static
// Host the public folder
app.use('/', express.static(app.get('public')));
// !end
// !code: use_end // !end

// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest(
  // !code: express_rest // !end
));
app.configure(socketio(
  // !code: express_socketio // !end
));
// Configure database adapters
app.configure(sequelize);

// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// Set up our services (see `services/index.ts`)
app.configure(services);
// Set up event channels (see channels.ts)
app.configure(channels);
// !code: config_middle // !end

// Configure a middleware for 404s and the error handler
github feathers-plus / generator-feathers-plus / test-expands / ts-cumulative-1-mongo.test-expected / src1 / app.ts View on Github external
// ! code: use_favicon
// Use favicon
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// !end
// ! code: use_static
// Host the public folder
app.use('/', express.static(app.get('public')));
// !end
// !code: use_end // !end

// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest(
  // !code: express_rest // !end
));
app.configure(socketio(
  // !code: express_socketio // !end
));
// Configure database adapters
app.configure(mongodb);

// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// Set up our services (see `services/index.ts`)
app.configure(services);
// Set up event channels (see channels.ts)
app.configure(channels);
// !code: config_middle // !end

// Configure a middleware for 404s and the error handler
github kalisio / krawler / src / cli.js View on Github external
export async function createApp (job, options = {}) {
  debug('Initializing krawler application')
  app = express(feathers())
  // Enable CORS, security, compression, and body parsing
  app.use(cors())
  app.use(helmet())
  app.use(compress())
  app.use(bodyParser.json())
  app.use(bodyParser.urlencoded({ extended: true }))

  const apiPrefix = (options.api ? options.apiPrefix : '')
  debug('API prefix ' + apiPrefix)
  app.configure(rest())
  app.configure(socketio({
    path: apiPrefix + 'ws',
    transports: ['websocket']
  }))
  // Env var can be overridden by option
  const sync = options.sync || process.env.SYNC_DB_URL
  if (sync) {
    app.sync = mubsub(sync)
    const channel = app.sync.channel('krawler-events')
    app.on('krawler', (event) => {
      channel.publish(event.name, event.data)
    })
  }
  app.configure(plugin())
  // In API mode everything is open, otherwise only health check is
  app.use('/', (req, res, next) => {
    if (options.api) next()
github DefinitelyTyped / DefinitelyTyped / types / feathersjs__socketio / feathersjs__socketio-tests.ts View on Github external
import feathers, { Application } from '@feathersjs/feathers';
import feathersSocketIO, { SOCKET_KEY } from '@feathersjs/socketio';

const app: Application = feathers();

app.configure(feathersSocketIO(1337, {}));
app.configure(feathersSocketIO(io => {}));
app.configure(feathersSocketIO({}, io => {}));
app.configure(feathersSocketIO(1337, io => {}));
app.configure(feathersSocketIO(1337, {}, io => {}));

app.channel('');
app.publish('', () => undefined);

const key = SOCKET_KEY;
github nesterow / frontless / src / lib / server / index.js View on Github external
app.UPDATE = FrontLess.UPDATE;
api.UPDATE = FrontLess.UPDATE;

const sessionMiddleware = session({
  secret: 'keyboard cat',
  resave: false,
  saveUninitialized: true,
  cookie: {secure: false},
})

app.use(cors());
app.use(sessionMiddleware);
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.configure(express.rest());
app.configure(socketio({}, function(io) {
  io.use(function(socket, next) {
    sessionMiddleware(socket.request, socket.request.res, next);
  });
  io.use(function(socket, next) {
    socket.feathers.request = socket.request;
    next();
  });
}));
app.configure(authentication({
  session: true,
  secret: '123sd234sdfsdf',
  service: 'users',
}));
app.configure(local());

@feathersjs/socketio

The Feathers Socket.io real-time API provider

MIT
Latest version published 2 months ago

Package Health Score

92 / 100
Full package analysis

Popular @feathersjs/socketio functions