MCPcopy Index your code
hub / github.com/simstudioai/sim / createPubSubChannel

Function createPubSubChannel

apps/sim/lib/events/pubsub.ts:140–156  ·  view source on GitHub ↗
(config: PubSubChannelConfig)

Source from the content-addressed store, hash-verified

138}
139
140export function createPubSubChannel<T>(config: PubSubChannelConfig): PubSubChannel<T> {
141 const redisUrl = env.REDIS_URL
142 if (!redisUrl) return new LocalPubSubChannel<T>(config)
143
144 // Resolve config-derived defaults outside the try so a missing
145 // REDIS_TLS_SERVERNAME (config error) surfaces instead of silently degrading
146 // to the in-process EventEmitter — that would break cross-replica pub/sub.
147 const connectionDefaults = getRedisConnectionDefaults(redisUrl)
148
149 try {
150 logger.info(`${config.label}: Using Redis`)
151 return new RedisPubSubChannel<T>(redisUrl, connectionDefaults, config)
152 } catch (err) {
153 logger.error(`Failed to create Redis ${config.label}, falling back to local:`, err)
154 return new LocalPubSubChannel<T>(config)
155 }
156}

Callers 4

chat-status.tsFile · 0.90
index.tsFile · 0.90
pubsub.tsFile · 0.90
getCancellationChannelFunction · 0.90

Calls 3

infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected