Package org.java_websocket.protocols
Class Protocol
java.lang.Object
org.java_websocket.protocols.Protocol
- All Implemented Interfaces:
IProtocol
Class which represents the protocol used as Sec-WebSocket-Protocol
- Since:
- 1.3.7
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptProvidedProtocol
(String inputProtocolHeader) Check if the received Sec-WebSocket-Protocol header field contains a offer for the specific protocolTo prevent protocols to be used more than once the Websocket implementation should call this method in order to create a new usable version of a given protocol instance.boolean
Return the specific Sec-WebSocket-protocol header offer for this protocol if the endpoint.int
hashCode()
toString()
Return a string which should contain the protocol name as well as additional information about the current configurations for this protocol (DEBUG purposes)
-
Constructor Details
-
Protocol
Constructor for a Sec-Websocket-Protocol- Parameters:
providedProtocol
- the protocol string
-
-
Method Details
-
acceptProvidedProtocol
Description copied from interface:IProtocol
Check if the received Sec-WebSocket-Protocol header field contains a offer for the specific protocol- Specified by:
acceptProvidedProtocol
in interfaceIProtocol
- Parameters:
inputProtocolHeader
- the received Sec-WebSocket-Protocol header field offered by the other endpoint- Returns:
- true, if the offer does fit to this specific protocol
-
getProvidedProtocol
Description copied from interface:IProtocol
Return the specific Sec-WebSocket-protocol header offer for this protocol if the endpoint. If the extension returns an empty string (""), the offer will not be included in the handshake.- Specified by:
getProvidedProtocol
in interfaceIProtocol
- Returns:
- the specific Sec-WebSocket-Protocol header for this protocol
-
copyInstance
Description copied from interface:IProtocol
To prevent protocols to be used more than once the Websocket implementation should call this method in order to create a new usable version of a given protocol instance.- Specified by:
copyInstance
in interfaceIProtocol
- Returns:
- a copy of the protocol
-
toString
Description copied from interface:IProtocol
Return a string which should contain the protocol name as well as additional information about the current configurations for this protocol (DEBUG purposes) -
equals
-
hashCode
public int hashCode()
-