Phase 2 refinements: Firebase config, dev environment fixes, phase 3 requirement draft
- Integrated Firebase SDK in both Flutter apps (google-services, firebase_options) - Fixed auth flow, API client, and pairing/status blocs for dev environment - Added full Flutter project scaffolds (android, ios, web, etc.) - Added phase 3 chat engine requirement document - Added bugreport zip pattern to gitignore Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,18 +30,24 @@ export const getValkeySub = () => {
|
||||
|
||||
export const publish = async (channel, data) => {
|
||||
const pubClient = getValkeyPub()
|
||||
await pubClient.publish(channel, JSON.stringify(data))
|
||||
const numReceivers = await pubClient.publish(channel, JSON.stringify(data))
|
||||
console.log(`[valkey] publish to ${channel} → ${numReceivers} receiver(s)`)
|
||||
}
|
||||
|
||||
export const subscribe = (channel, callback) => {
|
||||
const subClient = getValkeySub()
|
||||
subClient.subscribe(channel)
|
||||
subClient.on('message', (ch, message) => {
|
||||
console.log(`[valkey] subscribed to ${channel}`)
|
||||
const handler = (ch, message) => {
|
||||
if (ch === channel) {
|
||||
console.log(`[valkey] received on ${channel}`)
|
||||
callback(JSON.parse(message))
|
||||
}
|
||||
})
|
||||
}
|
||||
subClient.on('message', handler)
|
||||
return () => {
|
||||
subClient.unsubscribe(channel)
|
||||
subClient.removeListener('message', handler)
|
||||
console.log(`[valkey] unsubscribed from ${channel}`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user