Method: Bixby::WebSocket::APIChannel#execute_async

Defined in:
lib/bixby-common/websocket/api_channel.rb

#execute_async(json_request, &block) ⇒ String

Execute the given request (asynchronously)

Parameters:

Returns:

  • (String)

    request id



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/bixby-common/websocket/api_channel.rb', line 39

def execute_async(json_request, &block)
  logger.debug { "execute_async:\n#{json_request.to_s}" }

  request = Request.new(json_request)
  id = request.id
  @responses[id] = AsyncResponse.new(id, &block)

  EM.next_tick {
    ws.send(request.to_wire)
  }
  id
end