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



233
234
235
236
237
# File 'lib/cpee/implementation_notifications.rb', line 233

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

{{{



220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/cpee/implementation_notifications.rb', line 220

def onopen
  @opts = @a[1]
  @id = @a[0].to_s
  @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