This changelog follows the keep a changelog format to maintain a human readable changelog.
0.3.1 (2024-04-21)
- Added missing
@OnDisconnecting()
export to index
0.3.0 (2024-04-21)
- Middlewares without a defined namespace are registered on all namespaces
glob
package updated from10.0.0
to10.3.12
path-to-regexp
package updated from6.2.1
to6.2.2
reflect-metadata
package updated from0.1.13
to0.2.2
socket.io
package updated from4.5.4
to4.7.5
0.2.0 (2023-04-10)
-
Replaced
ScopedContainerGetterParams
withSocketEventContext
BEFORE:
scopedContainerGetter: (args: ScopedContainerGetterParams) => { // ... }
AFTER:
scopedContainerGetter: (args: SocketEventContext) => { // ... }
Note: The new interface contains all properties of the previous
- Added scoped container dispose support
- Added interceptor support
- Added ack support
glob
package updated from8.1.0
to10.0.0
0.1.2 (2023-01-30)
-
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 } });
0.1.1 (2023-01-27)
-
Added
@OnDisconnecting()
decorator -
Added error type filter option to
@EmitOnFail()
decoratorExample:
@EmitOnFail('message', {errorType: TypeError})
-
Added
index
option to@MessageBody()
decorator to be able to get multiple event argumentsNote: 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
glob
package updated from8.0.3
to8.1.0
0.1.0 (2023-01-18)
-
Removed
createSocketServer()
in favor of constructor initializationBEFORE:
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 initializationBEFORE:
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 initializationBEFORE:
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
- Namespace scope support for middlewares
transform: boolean
option to decorators that support class-transformer
class-transformer
package updated from0.1.6
to0.5.1
path-to-regexp
package updated from3.0.0
to6.2.1
reflect-metadata
package updated from0.1.10
to0.1.13
socket.io
package updated from2.0.1
to4.5.4
- updated various dev dependencies
0.0.5 - 2020-02-04
- Added support dynamic namespace
- Added
NspParams
,NspParam
decorators to handle dynamic namespace name params - Allowed use function array for controllers and middlewares
- Import middlewares from directory