The opening handshake of a WebSocket (RFC 6455, section 4) for both sides, strict and small: the request is a GET with the five required headers, no extensions and no subprotocol are offered or accepted, the header block is capped (lines, count, bytes), and nothing is read past the blank line (the first frame follows it on the same stream).
More...
|
| class | Request |
| | A request that arrived on the server side.
|
| |
|
|
static String | acceptFor (String key) |
| | Sec-WebSocket-Accept for a key (RFC 6455, section 1.3).
|
| |
| static void | connect (InputStream in, OutputStream out, String host, int port, String path, SecureRandom random) throws IOException |
| | Opens the connection: sends the request (no Origin header, as the protocol requires) and checks the answer.
|
| |
| static Request | accept (InputStream in, OutputStream out, boolean rejectOrigin) throws IOException |
| | Reads a request and answers it; for an endpoint that must refuse browsers, rejectOrigin answers 403 to a request that carries an Origin header (the protocol demands it of a client's endpoint).
|
| |
The opening handshake of a WebSocket (RFC 6455, section 4) for both sides, strict and small: the request is a GET with the five required headers, no extensions and no subprotocol are offered or accepted, the header block is capped (lines, count, bytes), and nothing is read past the blank line (the first frame follows it on the same stream).
◆ accept()
| static Request de.yaacc.sendspin.session.WsHandshake.accept |
( |
InputStream | in, |
|
|
OutputStream | out, |
|
|
boolean | rejectOrigin ) throws IOException |
|
static |
Reads a request and answers it; for an endpoint that must refuse browsers, rejectOrigin answers 403 to a request that carries an Origin header (the protocol demands it of a client's endpoint).
- Returns
- the request, after the 101 answer was sent
- Exceptions
-
| IOException | if the request is not a valid upgrade (a 400 or 403 answer was sent where possible) |
◆ connect()
| static void de.yaacc.sendspin.session.WsHandshake.connect |
( |
InputStream | in, |
|
|
OutputStream | out, |
|
|
String | host, |
|
|
int | port, |
|
|
String | path, |
|
|
SecureRandom | random ) throws IOException |
|
static |
Opens the connection: sends the request (no Origin header, as the protocol requires) and checks the answer.
- Parameters
-
| host | the host of the Host header (an IPv6 literal without brackets is bracketed here) |
| path | the request path of the advertised endpoint; it comes from the network and is checked |
- Exceptions
-
| IOException | if the server does not accept the upgrade or answers wrongly |
Referenced by de.yaacc.sendspin.hub.Connector.Sockets.open().
The documentation for this class was generated from the following file:
- /github/workspace/yaacc/src/main/java/de/yaacc/sendspin/session/WsHandshake.java