Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 11, 2025

Summary

This PR implements comprehensive GraphQL subscription support for real-time notifications of link changes in the Data.Doublets.Gql project.

Features Implemented

  • Real-time Subscriptions: Four subscription types for different use cases:

    • link_created: Notifies when new links are created
    • link_updated: Notifies when existing links are modified
    • link_deleted: Notifies when links are deleted (returns deleted link ID)
    • link_changed: Combined notifications for both created and updated links
  • Filtering Support: All subscriptions support where clause filtering using the existing LinksBooleanExpression input type

    • Filter by id, from_id, to_id
    • Additional complex filtering through existing boolean expression structure
  • Reactive Streams: Uses System.Reactive for proper observable stream handling

  • Event Integration: Mutation resolvers automatically trigger subscription notifications

  • WebSocket Transport: Leverages existing WebSocket infrastructure for real-time communication

Technical Implementation

  • Updated LinksSubscription class with reactive stream resolvers using IObservable<T>
  • Modified LinksMutation to emit events to subscription streams on create/update/delete operations
  • Added System.Reactive package dependency for proper reactive extensions support
  • Maintained full backward compatibility - no breaking changes to existing APIs

Example Usage

# Subscribe to new link creation
subscription {
  link_created(where: { from_id: { _eq: 1 } }) {
    id
    from_id  
    to_id
    type_id
  }
}

# Subscribe to all link changes
subscription {
  link_changed {
    id
    from_id
    to_id
    type_id
  }
}

Testing

  • All existing tests pass (8/8)
  • Build completes successfully with no compilation errors
  • Server configuration already supports WebSocket subscriptions through existing packages
  • Added comprehensive test documentation in examples/subscription_test.md

🤖 Generated with Claude Code


Resolves #31

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #31
@konard konard self-assigned this Sep 11, 2025
konard and others added 2 commits September 11, 2025 10:11
- Add reactive subscription resolvers for link events (create, update, delete)
- Integrate subscription notifications into mutation resolvers
- Add System.Reactive package dependency for observable streams
- Implement filtering support for subscription where clauses
- Add comprehensive subscription types: link_created, link_updated, link_deleted, link_changed
- Create example documentation and test cases
- All existing tests pass, no breaking changes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Subscriptions support Implement GraphQL Subscriptions Support Sep 11, 2025
@konard konard marked this pull request as ready for review September 11, 2025 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subscriptions support

2 participants