You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The @tsed/socketio library utilizes in-memory session storage allowing injecting the session data through @SocketSession decorator. However, this implementation is not compatible with socket.io adapters and the connection state recovery feature. Additionally, this approach can cause a growing memory footprint over time, which may impact the application's performance and stability.
To address the compatibility and memory footprint concerns, the usage of the @SocketSession decorator should be reworked. Instead of relying on in-memory session storage, the decorator should be modified to inject the value of socket.data, preserving backward compatibility with existing SocketIO implementations.
Example
@SocketService("/my-namespace")exportclassMySocketService{$onConnection(@Socketsocket: SocketIO.Socket, @SocketSessionsession: SocketSession){if(socket.recovered){// recovery was successful after the server crash, rolling update, etcconsole.log(session.get('key1'));// outputs value1}else{// new or unrecoverable sessionsession.set('key1','value1');}}}
The text was updated successfully, but these errors were encountered:
Information
7.x
@tsed/socketio
The
@tsed/socketio
library utilizes in-memory session storage allowing injecting the session data through@SocketSession
decorator. However, this implementation is not compatible with socket.io adapters and the connection state recovery feature. Additionally, this approach can cause a growing memory footprint over time, which may impact the application's performance and stability.To address the compatibility and memory footprint concerns, the usage of the
@SocketSession
decorator should be reworked. Instead of relying on in-memory session storage, the decorator should be modified to inject the value ofsocket.data
, preserving backward compatibility with existing SocketIO implementations.Example
The text was updated successfully, but these errors were encountered: