GoldenGateBindings / com.fitbit.goldengate.bindings.coap / Endpoint / responseFor

responseFor

abstract fun responseFor(request: OutgoingRequest): Single<IncomingResponse>

Call this to send a request and get a response (i.e. be a client).

Parameters

request - The request that should be sent to the CoAP server. Use OutgoingRequestBuilder to construct requests.

Return
A Single that will emit either an IncomingResponse returned from the CoAP server or an error

open fun <T> responseFor(request: OutgoingRequest, parser: ByteArrayParser<T>): Single<T>

Convenience method for parsing a Response into a T

Parameters

T - The type of response object expected from this request

request - The request to send over CoAP.

parser - An object that knows how to construct an object of type T from a ByteArray

Return
A Single that will emit either the response parsed into a T or an error.