Class: CPEE::Notifications::SSE

Inherits:
Riddl::SSEImplementation
  • Object
show all
Defined in:
lib/cpee/implementation_notifications.rb

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#oncloseObject



210
211
212
213
214
# File 'lib/cpee/implementation_notifications.rb', line 210

def onclose
  @opts.dig(:sse_connections,@id)&.delete(@key)
  @opts.dig(:sse_connections)&.delete(@id) if @opts.dig(:sse_connections,@id)&.length == 0
  DeleteSubscription::set(@id,@opts,@key)
end

#onopenObject

{{{



197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/cpee/implementation_notifications.rb', line 197

def onopen
  @opts = @a[1]
  @id = @a[0]
  @key = @r[-2]
  if CPEE::Persistence::exists_handler?(@id,@opts,@key)
    @opts[:sse_connections][@id] ||= {}
    @opts[:sse_connections][@id][@key] = self
    true
  else
    false
  end
end