Skip to content

Instantly share code, notes, and snippets.

View rmosolgo's full-sized avatar
🧀

Robert Mosolgo rmosolgo

🧀
View GitHub Profile
@lemuelbarango
lemuelbarango / webhook_subscription.rb
Last active June 12, 2020 19:47
GraphQL Ruby Webhook Subscriptions Implementation
require 'graphql'
require 'securerandom'
require 'httparty'
class WebhookSubscriptions < GraphQL::Subscriptions
def initialize(**args)
super
# Using concurrent maps to persist events and subscription information
# This can be switched for a DATABASE table/columns
@events = Concurrent::Map.new { |h, event_id| h[event_id] = [] }