Files
IRC-kosmi-relay/GRAPHQL_OPERATIONS_AUDIT.md

109 lines
3.4 KiB
Markdown
Raw Normal View History

2025-11-01 21:00:16 -04:00
# GraphQL Operations Audit - Browser vs Bot
## Operations We're Currently Sending
### 1. ✅ connection_init
**Status**: Correct
- Sending token, ua, v, r parameters
- Matches browser
### 2. ✅ ExtendedCurrentUserQuery
**Status**: Correct (simplified)
- **Browser**: Full query with realmInfo, colorSchemes, friends, etc.
- **Bot**: Simplified to just currentUser fields we need
- **Verdict**: OK - we don't need all the UI-related fields
### 3. ✅ NewMessageSubscription
**Status**: Fixed (just updated)
- Added channelId parameter
- Added operationName
- Added all required fields (member, reactions, etc.)
### 4. ✅ JoinRoom
**Status**: Needs verification
- **Browser**: `mutation JoinRoom($id: String!, $disconnectOtherConnections: Boolean)`
- **Bot**: `mutation JoinRoom($id: String!)`
- **Issue**: Missing `$disconnectOtherConnections` parameter
### 5. ✅ SendMessage2
**Status**: Fixed (just updated)
- Added channelId, replyToMessageId parameters
- Added operationName
- Matches browser
### 6. ❌ anonLogin
**Status**: Only used for anonymous - OK
## Critical Operations the Browser Sends That We're Missing
### Room Management
1. **RoomRootQuery** - Gets room metadata
2. **WithGetMembers** - Gets room members list
3. **RoomChatQuery** - Gets chat history
### Member Events (Important!)
4. **MemberJoins** - Subscription for when members join
5. **MemberLeaves** - Subscription for when members leave
6. **NewMemberSubscription** - Another member join subscription
### Message Events
7. **MessageDeletedSubscription** - When messages are deleted
8. **MessageEditedSubscription** - When messages are edited
9. **ReactionAdded** - When reactions are added
10. **ReactionRemoved** - When reactions are removed
### Typing Indicators
11. **UserTyping** - Subscription for typing indicators
12. **StartTyping** - Mutation to send typing status
### Room State
13. **RoomDisconnect** - Subscription for disconnect events
14. **SetRole2** - Role changes subscription
## Priority Operations to Add
### HIGH PRIORITY (Required for basic functionality)
1. **JoinRoom** - Fix to include `disconnectOtherConnections` parameter
2. **WithGetMembers** - May be needed to see room members properly
3. **RoomChatQuery** - May be needed to receive messages properly
### MEDIUM PRIORITY (Nice to have)
4. **MemberJoins/MemberLeaves** - For presence notifications
5. **MessageDeletedSubscription** - Handle deleted messages
6. **UserTyping** - Typing indicators (already on our roadmap)
### LOW PRIORITY (Optional)
7. All the media player, spaces, WebRTC subscriptions - Not needed for chat relay
## Next Steps
1. ✅ Fix JoinRoom mutation to include disconnectOtherConnections
2. ⏳ Test if current changes fix message sending/receiving
3. ⏳ Add WithGetMembers if needed
4. ⏳ Add RoomChatQuery if needed
5. ⏳ Add member join/leave subscriptions for better presence tracking
## Browser Operation Sequence (First Connection)
1. connection_init (with token)
2. SettingsQuery
3. ExtendedCurrentUserQuery
4. UserRoomQuery
5. WebRTCIceServerQuery
6. (various other queries)
7. **JoinRoom** ← We do this
8. (many subscriptions)
9. **NewMessageSubscription** ← We do this
10. (more subscriptions)
## Our Current Sequence
1. connection_init (with token) ✅
2. ExtendedCurrentUserQuery ✅
3. NewMessageSubscription ✅
4. JoinRoom ✅
5. (start listening)
**Observation**: We're subscribing to messages BEFORE joining the room, but the browser does it AFTER. Let's check if order matters.