WebSocketStorage
actor WebSocketStorage
This is the datatype that gets stored in UserCacheStorage. Vapor’s Services API uses this. Making this a class instead of a struct. This prevents internal modifications (e.g. adding/removing a value from the dicts) from causing the entire app.storage getting copied, in the case where app.storage is a value type composed of other value types. The custom setter for app.storage is not thread-safe. So, this is a workaround for app.storage having a non-thread-safe setter.
-
Declaration
Swift
private var sockets: [UUID : [UserSocket]]
-
Declaration
Swift
func getSockets(_ forID: UUID) -> [UserSocket]
-
Declaration
Swift
func getSockets<T>(idList: T) -> [UserSocket] where T : Sequence, T.Element == UUID
-
Declaration
Swift
func hasSocket(forID: UUID) -> Bool
-
Declaration
Swift
func forwardToSockets(app: Application, idList: [UUID], type: NotificationType, info: String)
-
Declaration
Swift
func storeSocket(_ socket: UserSocket, withID: UUID)
-
Declaration
Swift
func removeSocket(_ socket: UserSocket, fromID: UUID)
-
handleUserLogout(_:
AsynchronousisUserIndexed: ) Declaration
Swift
func handleUserLogout(_ userID: UUID, isUserIndexed: Bool) async