final case class WebSocketRequest[F[_], T](method: Method, uri: Uri, body: BasicBody, headers: Seq[Header], response: WebSocketResponseAs[F, T], options: RequestOptions, tags: Map[String, Any]) extends GenericRequest[T, WebSockets with Effect[F]] with RequestBuilder[WebSocketRequest[F, T]] with Product with Serializable
Describes an HTTP WebSocket request.
The request can be sent using an instance of WebSocketBackend with the send method.
- F
The effect type used to process the WebSocket. Might include asynchronous computations (e.g. scala.concurrent.Future), pure effect descriptions (
IO
), or synchronous computations (Identity).- T
The target type, to which the response body should be read. If the WebSocket interactions are described entirely by the response description, this might be
Unit
. Otherwise, this can be a sttp.ws.WebSocket instance.- response
Description of how the WebSocket should be handled. Needs to be specified upfront so that the response is always consumed and hence there are no requirements on client code to consume it.
- tags
Request-specific tags which can be used by backends for logging, metrics, etc. Empty by default.
- Alphabetic
- By Inheritance
- WebSocketRequest
- Serializable
- Serializable
- Product
- Equals
- GenericRequest
- RequestMetadata
- RequestBuilder
- PartialRequestBuilder
- PartialRequestExtensions
- HasHeaders
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
WebSocketRequest(method: Method, uri: Uri, body: BasicBody, headers: Seq[Header], response: WebSocketResponseAs[F, T], options: RequestOptions, tags: Map[String, Any])
- response
Description of how the WebSocket should be handled. Needs to be specified upfront so that the response is always consumed and hence there are no requirements on client code to consume it.
- tags
Request-specific tags which can be used by backends for logging, metrics, etc. Empty by default.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
acceptEncoding(encoding: String): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
auth: SpecifyAuthScheme[WebSocketRequest[F, T]]
- Definition Classes
- PartialRequestBuilder
-
def
autoDecompressionDisabled: Boolean
- Definition Classes
- PartialRequestBuilder
-
def
body(fs: Seq[(String, String)], encoding: String): WebSocketRequest[F, T]
Encodes the given parameters as form data.
Encodes the given parameters as form data. If content type is not yet specified, will be set to
application/x-www-form-urlencoded
.If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.
- Definition Classes
- PartialRequestBuilder
-
def
body(fs: (String, String)*): WebSocketRequest[F, T]
Encodes the given parameters as form data using
utf-8
.Encodes the given parameters as form data using
utf-8
. If content type is not yet specified, will be set toapplication/x-www-form-urlencoded
.If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.
- Definition Classes
- PartialRequestBuilder
-
def
body(fs: Map[String, String], encoding: String): WebSocketRequest[F, T]
Encodes the given parameters as form data.
Encodes the given parameters as form data. If content type is not yet specified, will be set to
application/x-www-form-urlencoded
.If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.
- Definition Classes
- PartialRequestBuilder
-
def
body(fs: Map[String, String]): WebSocketRequest[F, T]
Encodes the given parameters as form data using
utf-8
.Encodes the given parameters as form data using
utf-8
. If content type is not yet specified, will be set toapplication/x-www-form-urlencoded
.If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.
- Definition Classes
- PartialRequestBuilder
-
def
body(b: InputStream): WebSocketRequest[F, T]
If content type is not yet specified, will be set to
application/octet-stream
.If content type is not yet specified, will be set to
application/octet-stream
.- Definition Classes
- PartialRequestBuilder
-
def
body(b: ByteBuffer): WebSocketRequest[F, T]
If content type is not yet specified, will be set to
application/octet-stream
.If content type is not yet specified, will be set to
application/octet-stream
.- Definition Classes
- PartialRequestBuilder
-
def
body(b: Array[Byte]): WebSocketRequest[F, T]
If content type is not yet specified, will be set to
application/octet-stream
.If content type is not yet specified, will be set to
application/octet-stream
.If content length is not yet specified, will be set to the length of the given array.
- Definition Classes
- PartialRequestBuilder
-
def
body(b: String, encoding: String): WebSocketRequest[F, T]
If content type is not yet specified, will be set to
text/plain
with the given encoding.If content type is not yet specified, will be set to
text/plain
with the given encoding.If content length is not yet specified, will be set to the number of bytes in the string using the given encoding.
- Definition Classes
- PartialRequestBuilder
-
def
body(b: String): WebSocketRequest[F, T]
Uses the
utf-8
encoding.Uses the
utf-8
encoding.If content type is not yet specified, will be set to
text/plain
withutf-8
encoding.If content length is not yet specified, will be set to the number of bytes in the string using the
utf-8
encoding.- Definition Classes
- PartialRequestBuilder
-
def
body[B](b: B)(implicit arg0: BodySerializer[B]): WebSocketRequest[F, T]
If content type is not yet specified, will be set to
application/octet-stream
.If content type is not yet specified, will be set to
application/octet-stream
.- Definition Classes
- PartialRequestExtensions
-
def
body(path: Path): WebSocketRequest[F, T]
If content type is not yet specified, will be set to
application/octet-stream
.If content type is not yet specified, will be set to
application/octet-stream
.If content length is not yet specified, will be set to the length of the given file.
- Definition Classes
- PartialRequestExtensions
-
def
body(file: File): WebSocketRequest[F, T]
If content type is not yet specified, will be set to
application/octet-stream
.If content type is not yet specified, will be set to
application/octet-stream
.If content length is noBodySerializert yet specified, will be set to the length of the given file.
- Definition Classes
- PartialRequestExtensions
-
val
body: BasicBody
- Definition Classes
- WebSocketRequest → GenericRequest → PartialRequestBuilder
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
contentLength(l: Long): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
contentLength: Option[Long]
- Definition Classes
- HasHeaders
-
def
contentType(ct: String, encoding: String): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
contentType(mt: MediaType): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
contentType(ct: String): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
contentType: Option[String]
- Definition Classes
- HasHeaders
-
def
cookie(n: String, v: String): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
cookie(nv: (String, String)): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
cookies(nvs: (String, String)*): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
cookies(cs: Iterable[CookieWithMeta]): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
cookies(r: Response[_]): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
cookies: Seq[Either[String, CookieWithMeta]]
- Definition Classes
- HasHeaders
-
def
copyWithBody(body: BasicBody): WebSocketRequest[F, T]
- Attributes
- protected
- Definition Classes
- WebSocketRequest → PartialRequestBuilder
-
def
delete(uri: Uri): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
disableAutoDecompression: WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
followRedirects(fr: Boolean): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
get(uri: Uri): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
head(uri: Uri): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
header(k: String, ov: Option[String]): WebSocketRequest[F, T]
Adds the given header to the end of the headers sequence, if the value is defined.
Adds the given header to the end of the headers sequence, if the value is defined. Otherwise has no effect.
- Definition Classes
- PartialRequestBuilder
-
def
header(k: String, v: String): WebSocketRequest[F, T]
Adds the given header to the end of the headers sequence.
Adds the given header to the end of the headers sequence.
- Definition Classes
- PartialRequestBuilder
-
def
header(k: String, v: String, replaceExisting: Boolean): WebSocketRequest[F, T]
Adds the given header to the end of the headers sequence.
Adds the given header to the end of the headers sequence.
- replaceExisting
If there's already a header with the same name, should it be replaced?
- Definition Classes
- PartialRequestBuilder
-
def
header(h: Header, replaceExisting: Boolean = false): WebSocketRequest[F, T]
Adds the given header to the end of the headers sequence.
Adds the given header to the end of the headers sequence.
- replaceExisting
If there's already a header with the same name, should it be replaced?
- Definition Classes
- PartialRequestBuilder
-
def
header(h: String): Option[String]
- Definition Classes
- HasHeaders
-
def
headers(hs: Seq[Header], replaceExisting: Boolean): WebSocketRequest[F, T]
Adds the given headers to the end of the headers sequence.
Adds the given headers to the end of the headers sequence.
- Definition Classes
- PartialRequestBuilder
-
def
headers(hs: Header*): WebSocketRequest[F, T]
Adds the given headers to the end of the headers sequence.
Adds the given headers to the end of the headers sequence.
- Definition Classes
- PartialRequestBuilder
-
def
headers(hs: Map[String, String], replaceExisting: Boolean): WebSocketRequest[F, T]
Adds the given headers to the end of the headers sequence.
Adds the given headers to the end of the headers sequence.
- replaceExisting
If there's already a header with the same name, should it be replaced?
- Definition Classes
- PartialRequestBuilder
-
def
headers(hs: Map[String, String]): WebSocketRequest[F, T]
Adds the given headers to the end of the headers sequence.
Adds the given headers to the end of the headers sequence.
- Definition Classes
- PartialRequestBuilder
-
def
headers(h: String): Seq[String]
- Definition Classes
- HasHeaders
-
val
headers: Seq[Header]
- Definition Classes
- WebSocketRequest → PartialRequestBuilder → HasHeaders
-
def
httpVersion: Option[HttpVersion]
GetHttpVersion from tags in request.
GetHttpVersion from tags in request. Supported only is a few backends
- returns
one of values form HttpVersion enum or None
- Definition Classes
- PartialRequestBuilder
-
def
httpVersion(version: HttpVersion): WebSocketRequest[F, T]
Allows setting HTTP version per request.
Allows setting HTTP version per request. Supported only is a few backends
- returns
request with version tag
- Definition Classes
- PartialRequestBuilder
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isWebSocket: Boolean
- Definition Classes
- GenericRequest
-
def
logSettings(logRequestBody: Option[Boolean] = None, logResponseBody: Option[Boolean] = None, logRequestHeaders: Option[Boolean] = None, logResponseHeaders: Option[Boolean] = None): WebSocketRequest[F, T]
Will only have effect when using the
LoggingBackend
Will only have effect when using the
LoggingBackend
- Definition Classes
- PartialRequestBuilder
-
def
loggingOptions: Option[LoggingOptions]
- Definition Classes
- PartialRequestBuilder
-
def
mapResponse[T2](f: (T) ⇒ T2): WebSocketRequest[F, T2]
- Definition Classes
- WebSocketRequest → GenericRequest
-
def
maxRedirects(n: Int): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
method(method: Method, uri: Uri): WebSocketRequest[F, T]
- Definition Classes
- WebSocketRequest → PartialRequestBuilder
-
val
method: Method
- Definition Classes
- WebSocketRequest → RequestMetadata
-
def
multipartBody(p1: Part[BasicBodyPart], ps: Part[BasicBodyPart]*): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
multipartBody(ps: Seq[Part[BasicBodyPart]]): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
onlyMetadata: RequestMetadata
Metadata of the request, which doesn't retain the request body, or the response handling specification.
Metadata of the request, which doesn't retain the request body, or the response handling specification.
- Definition Classes
- GenericRequest
-
def
options(uri: Uri): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
val
options: RequestOptions
- Definition Classes
- WebSocketRequest → PartialRequestBuilder
-
def
patch(uri: Uri): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
post(uri: Uri): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
proxyAuth: SpecifyAuthScheme[WebSocketRequest[F, T]]
- Definition Classes
- PartialRequestBuilder
-
def
put(uri: Uri): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
readTimeout(t: Duration): WebSocketRequest[F, T]
When the request is sent, if reading the response times out (there's no activity for the given period of time), a failed effect will be returned, or an exception will be thrown
When the request is sent, if reading the response times out (there's no activity for the given period of time), a failed effect will be returned, or an exception will be thrown
- Definition Classes
- PartialRequestBuilder
-
def
redirectToGet(r: Boolean): WebSocketRequest[F, T]
When a POST or PUT request is redirected, should the redirect be a POST/PUT as well (with the original body), or should the request be converted to a GET without a body.
When a POST or PUT request is redirected, should the redirect be a POST/PUT as well (with the original body), or should the request be converted to a GET without a body.
Note that this only affects 301 and 302 redirects. 303 redirects are always converted, while 307 and 308 redirects always keep the same method.
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections for details.
- Definition Classes
- PartialRequestBuilder
-
val
response: WebSocketResponseAs[F, T]
Description of how the response body should be handled.
Description of how the response body should be handled. Needs to be specified upfront so that the response is always consumed and hence there are no requirements on client code to consume it.
- Definition Classes
- WebSocketRequest → GenericRequest → PartialRequestBuilder
-
def
send(backend: WebSocketSyncBackend)(implicit ev: =:=[Identity[T], F[T]]): Response[T]
Sends the WebSocket request synchronously, using the given backend.
Sends the WebSocket request synchronously, using the given backend.
- returns
A Response, with the body handled as specified by this request (see Request.response). The response WebSocket is handled as specified by this request (see Request.response). Known exceptions are converted by backends to one of SttpClientException. Other exceptions are thrown unchanged.
-
def
send(backend: WebSocketBackend[F]): F[Response[T]]
Sends the WebSocket request, using the given backend.
Sends the WebSocket request, using the given backend.
- returns
An
F
-effect, containing a Response, with the body handled as specified by this request (see Request.response). Effects might include asynchronous computations (e.g. scala.concurrent.Future), pure effect descriptions (IO
), or error wrappers (e.g. TryBackend). Exceptions are represented as failed effects (e.g. failed futures). The response WebSocket is handled as specified by this request (see Request.response). Known exceptions are converted by backends to one of SttpClientException. Other exceptions are thrown unchanged.
-
def
show(includeBody: Boolean = true, includeHeaders: Boolean = true, sensitiveHeaders: Set[String] = HeaderNames.SensitiveHeaders): String
- Definition Classes
- PartialRequestBuilder
-
def
showBasic: String
- Definition Classes
- WebSocketRequest → PartialRequestBuilder
- def streamBody[S](s: Streams[S])(b: BinaryStream): WebSocketStreamRequest[T, Effect[F] with S]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tag(k: String): Option[Any]
- Definition Classes
- PartialRequestBuilder
-
def
tag(k: String, v: Any): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
val
tags: Map[String, Any]
Request-specific tags which can be used by backends for logging, metrics, etc.
Request-specific tags which can be used by backends for logging, metrics, etc. Empty by default.
- Definition Classes
- WebSocketRequest → PartialRequestBuilder
-
def
toCurl(sensitiveHeaders: Set[String], omitAcceptEncoding: Boolean): String
- Definition Classes
- GenericRequest
-
def
toCurl(omitAcceptEncoding: Boolean): String
- Definition Classes
- GenericRequest
-
def
toCurl(sensitiveHeaders: Set[String]): String
- Definition Classes
- GenericRequest
-
def
toCurl: String
- Definition Classes
- GenericRequest
-
def
toRfc2616Format(sensitiveHeaders: Set[String]): String
- Definition Classes
- GenericRequest
-
def
toRfc2616Format: String
- Definition Classes
- GenericRequest
-
def
toString(): String
- Definition Classes
- RequestMetadata → AnyRef → Any
-
def
unsafeCookies: Seq[CookieWithMeta]
- Definition Classes
- HasHeaders
-
val
uri: Uri
- Definition Classes
- WebSocketRequest → RequestMetadata
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
withBody(body: BasicBody): WebSocketRequest[F, T]
- Definition Classes
- PartialRequestBuilder
-
def
withHeaders(headers: Seq[Header]): WebSocketRequest[F, T]
Replace all headers with the given ones.
Replace all headers with the given ones.
- Definition Classes
- WebSocketRequest → PartialRequestBuilder
-
def
withOptions(options: RequestOptions): WebSocketRequest[F, T]
Replace all options with the given ones.
Replace all options with the given ones.
- Definition Classes
- WebSocketRequest → PartialRequestBuilder
-
def
withTags(tags: Map[String, Any]): WebSocketRequest[F, T]
Replace all tags with the given ones.
Replace all tags with the given ones.
- Definition Classes
- WebSocketRequest → PartialRequestBuilder
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated