Socket
Socket
Sign inDemoInstall

socket-controllers

Package Overview
Dependencies
49
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install
2Next

0.3.1

Diff

Changelog

Source

0.3.1 (2024-04-21)

Changed

  • Added missing @OnDisconnecting() export to index
typestack-release-bot
published 0.3.0 •

Changelog

Source

0.3.0 (2024-04-21)

Breaking Changes

  • Middlewares without a defined namespace are registered on all namespaces

Changed

  • glob package updated from 10.0.0 to 10.3.12
  • path-to-regexp package updated from 6.2.1 to 6.2.2
  • reflect-metadata package updated from 0.1.13 to 0.2.2
  • socket.io package updated from 4.5.4 to 4.7.5
typestack-release-bot
published 0.2.0 •

Changelog

Source

0.2.0 (2023-04-10)

Breaking Changes

  • Replaced ScopedContainerGetterParams with SocketEventContext

    BEFORE:

    scopedContainerGetter: (args: ScopedContainerGetterParams) => {
      // ...
    }
    

    AFTER:

    scopedContainerGetter: (args: SocketEventContext) => {
      // ...
    }
    

    Note: The new interface contains all properties of the previous

Added

  • Added scoped container dispose support
  • Added interceptor support
  • Added ack support

Changed

  • glob package updated from 8.1.0 to 10.0.0
typestack-release-bot
published 0.1.2 •

Changelog

Source

0.1.2 (2023-01-30)

Added

  • Added scoped controller support

    // create and run socket server
    const server = new SocketControllers({
      ...
      scopedContainerGetter: (args: ScopedContainerGetterParams) => {
        // Return a container instance to be used to instantiate 
        // the controllers and their dependencies on each event
      }
    });
    
typestack-release-bot
published 0.1.1 •

Changelog

Source

0.1.1 (2023-01-27)

Added

  • Added @OnDisconnecting() decorator

  • Added error type filter option to @EmitOnFail() decorator

    Example: @EmitOnFail('message', {errorType: TypeError})

  • Added index option to @MessageBody() decorator to be able to get multiple event arguments

    Note: If you don't specify the index it will return the first

  • Added support to use the same namespace for multiple controllers

    Note: The namespaces must match exactly, providing a differnet pattern will not work due to a socket.io limitation

Changed

  • glob package updated from 8.0.3 to 8.1.0
typestack-release-bot
published 0.1.0 •

Changelog

Source

0.1.0 (2023-01-18)

Breaking Changes

  • Removed createSocketServer() in favor of constructor initialization

    BEFORE:

    import { useSocketServer } from 'socket-controllers';
    import { Server } from 'socket.io';
    
    const io = new Server(PORT);
    useSocketServer(io);
    

    AFTER:

    import { SocketControllers } from "socket-controllers";
    import { Server } from "socket.io";
    
    const io = new Server(PORT);
    new SocketControllers({io: io, container: YOUR_DI_CONTAINER});
    
  • Removed createSocketServer() in favor of constructor initialization

    BEFORE:

    import { createSocketServer } from 'socket-controllers';
    
    const io = createSocketServer(PORT);
    

    AFTER:

    import { SocketControllers } from "socket-controllers";
    
    const server = new SocketControllers({port: PORT, container: YOUR_DI_CONTAINER});
    const io = server.io;
    
  • Removed useContainer() in favor of constructor initialization

    BEFORE:

    import { useContainer } from 'socket-controllers';
    import { Container } from 'typedi';
    
    useContainer(Container);
    

    AFTER:

    import { SocketControllers } from "socket-controllers";
    import { Container } from 'typedi';
    
    const server = new SocketControllers({port: PORT, container: Container});
    

    Note: DI container is not included anymore, you have to provide your own.

  • Changed initialization parameters

    Before:

    interface SocketControllersOptions {
      controllers?: Function[] | string[];
      middlewares?: Function[] | string[];
      useClassTransformer?: boolean;
      classToPlainTransformOptions?: ClassTransformOptions;
      plainToClassTransformOptions?: ClassTransformOptions;
    }
    

    After:

    interface SocketControllersOptions {
      container: { get<T>(someClass: { new (...args: any[]): T } | Function): T };
      io?: Server;
      port?: number;
      controllers?: Function[] | string[];
      middlewares?: Function[] | string[];
      transformOption?: Partial<{
        transform?: boolean;
        parameterTransformOptions?: ClassTransformOptions;
        resultTransformOptions?: ClassTransformOptions;
      }>;
    }
    
  • Changed class-transformer property name in decorators that support class-transformer

    Before: classTransformOptions?: ClassTransformOptions

    After: transformOptions?: ClassTransformOptions

Added

  • Namespace scope support for middlewares
  • transform: boolean option to decorators that support class-transformer

Changed

  • class-transformer package updated from 0.1.6 to 0.5.1
  • path-to-regexp package updated from 3.0.0 to 6.2.1
  • reflect-metadata package updated from 0.1.10 to 0.1.13
  • socket.io package updated from 2.0.1 to 4.5.4
  • updated various dev dependencies
rustam95
published 0.1.0-alpha •

rustam95
published 0.0.5 •

Changelog

Source

[0.0.5][v0.0.5] - 2020-02-04

Added
  • Added support dynamic namespace
  • Added NspParams, NspParam decorators to handle dynamic namespace name params
  • Allowed use function array for controllers and middlewares
Fixed
  • Import middlewares from directory
rustam95
published 0.0.5-beta •

rustam95
published 0.0.4 •

2Next
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc