YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.sendspin.session.WsHandshake Class Reference

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...

Collaboration diagram for de.yaacc.sendspin.session.WsHandshake:
Collaboration graph

Classes

class  Request
 A request that arrived on the server side.
 

Static Public Member Functions

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).
 

Detailed Description

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).

Member Function Documentation

◆ 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
IOExceptionif the request is not a valid upgrade (a 400 or 403 answer was sent where possible)
Here is the call graph for this function:

◆ 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
hostthe host of the Host header (an IPv6 literal without brackets is bracketed here)
paththe request path of the advertised endpoint; it comes from the network and is checked
Exceptions
IOExceptionif the server does not accept the upgrade or answers wrongly

Referenced by de.yaacc.sendspin.hub.Connector.Sockets.open().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: