of method
Returns the Instance of PoloServer
associated with the Namespace
or Creates the Instance if not present
Implementation
PoloServer of(String namespace) {
if (!_namespaces.containsKey(namespace)) {
Stream<WebSocket> socketStream = _httpServer
.where((req) => req.uri.path == namespace)
.transform(WebSocketTransformer());
_namespaces[namespace] = PoloServer._fromManager(
socketStream, (() => _namespaces.remove(namespace)));
}
return _namespaces[namespace]!;
}