Interface Transport
-
- All Known Implementing Classes:
OkHttpTransport
public interface Transport
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_REQUEST_SIZE
-
-
-
Field Detail
-
MAX_REQUEST_SIZE
static final int MAX_REQUEST_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
roundTrip
Response roundTrip(Request request) throws Exception
Performs an HTTP request using the given request object. If the request results in a Stitch service error, the caller is responsible for callingStitchError.handleRequestError(Response)
to decode the exception, as this method will not throw the service exception.- Parameters:
request
- The HTTP request to perform.- Returns:
- The response to the request.
- Throws:
Exception
- if the request fails in transport for any reason. This will not be aStitchServiceException
, since those must be decoded by the caller.
-
stream
EventStream stream(Request request) throws IOException, StitchServiceException
Opens a Server-Sent Event (SSE) stream. See https://www.w3.org/TR/2009/WD-eventsource-20090421/ for specification details. If the underlying request to the Stitch server results in a service exception, this function will detect it and throw it, unlike theroundTrip(Request)
method.- Parameters:
request
- The request to open the stream.- Returns:
- A raw
EventStream
representing the opened change stream. - Throws:
IOException
- if the request fails to due to an I/O errorStitchServiceException
- if the request to the Stitch server was completed, but the stream could not be opened due to a Stitch error (such as "InvalidSession").
-
close
void close()
-
-