Top Description Methods
org.java_websocket.extensions

public Interface IExtension

Known Direct Implementers
org.java_websocket.extensions.DefaultExtension
Imports
org.java_websocket.exceptions.InvalidDataException, org.java_websocket.framing.Framedata

Interface which specifies all required methods to develop a websocket extension.
Since
1.3.5

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true, if the offer does fit to this specific extension
acceptProvidedExtensionAsClient
(String
the received Sec-WebSocket-Extensions header field offered by the other endpoint
inputExtensionHeader
)

Check if the received Sec-WebSocket-Extensions header field contains a offer for the specific extension if the endpoint is in the role of a client

public boolean

Returns:

true, if the offer does fit to this specific extension
acceptProvidedExtensionAsServer
(String
the received Sec-WebSocket-Extensions header field offered by the other endpoint
inputExtensionHeader
)

Check if the received Sec-WebSocket-Extensions header field contains a offer for the specific extension if the endpoint is in the role of a server

public IExtension

Returns:

a copy of the extension
copyInstance
()

Extensions must only be by one websocket at all.

public void
decodeFrame(Framedata
the frame, which has do be decoded to be used in the application
inputFrame
)

Decode a frame with a extension specific algorithm.

public void
encodeFrame(Framedata
the frame, which has do be encoded to be used on the other endpoint
inputFrame
)

Encode a frame with a extension specific algorithm.

public String

Returns:

the specific Sec-WebSocket-Extensions header for this extension
getProvidedExtensionAsClient
()

Return the specific Sec-WebSocket-Extensions header offer for this extension if the endpoint is in the role of a client.

public String

Returns:

the specific Sec-WebSocket-Extensions header for this extension
getProvidedExtensionAsServer
()

Return the specific Sec-WebSocket-Extensions header offer for this extension if the endpoint is in the role of a server.

public void
isFrameValid(Framedata
the received frame
inputFrame
)

Check if the received frame is correctly implemented by the other endpoint and there are no specification errors (like wrongly set RSV)

public void
reset()

Cleaning up internal stats when the draft gets reset.

public String

Returns:

a string containing the class name as well as additional information
toString
()

Return a string which should contain the class name as well as additional information about the current configurations for this extension (DEBUG purposes)

Method Detail

acceptProvidedExtensionAsClientback to summary
public boolean acceptProvidedExtensionAsClient(String inputExtensionHeader)

Check if the received Sec-WebSocket-Extensions header field contains a offer for the specific extension if the endpoint is in the role of a client

Parameters
inputExtensionHeader:String

the received Sec-WebSocket-Extensions header field offered by the other endpoint

Returns:boolean

true, if the offer does fit to this specific extension

Since
1.3.5
acceptProvidedExtensionAsServerback to summary
public boolean acceptProvidedExtensionAsServer(String inputExtensionHeader)

Check if the received Sec-WebSocket-Extensions header field contains a offer for the specific extension if the endpoint is in the role of a server

Parameters
inputExtensionHeader:String

the received Sec-WebSocket-Extensions header field offered by the other endpoint

Returns:boolean

true, if the offer does fit to this specific extension

Since
1.3.5
copyInstanceback to summary
public IExtension copyInstance()

Extensions must only be by one websocket at all. To prevent extensions to be used more than once the Websocket implementation should call this method in order to create a new usable version of a given extension instance.
The copy can be safely used in conjunction with a new websocket connection.

Returns:IExtension

a copy of the extension

Since
1.3.5
decodeFrameback to summary
public void decodeFrame(Framedata inputFrame) throws InvalidDataException

Decode a frame with a extension specific algorithm. The algorithm is subject to be implemented by the specific extension. The resulting frame will be used in the application

Parameters
inputFrame:Framedata

the frame, which has do be decoded to be used in the application

Exceptions
InvalidDataException:
Throw InvalidDataException if the received frame is not correctly implemented by the other endpoint or there are other protocol errors/decoding errors
Since
1.3.5
encodeFrameback to summary
public void encodeFrame(Framedata inputFrame)

Encode a frame with a extension specific algorithm. The algorithm is subject to be implemented by the specific extension. The resulting frame will be send to the other endpoint.

Parameters
inputFrame:Framedata

the frame, which has do be encoded to be used on the other endpoint

Since
1.3.5
getProvidedExtensionAsClientback to summary
public String getProvidedExtensionAsClient()

Return the specific Sec-WebSocket-Extensions header offer for this extension if the endpoint is in the role of a client. If the extension returns an empty string (""), the offer will not be included in the handshake.

Returns:String

the specific Sec-WebSocket-Extensions header for this extension

Since
1.3.5
getProvidedExtensionAsServerback to summary
public String getProvidedExtensionAsServer()

Return the specific Sec-WebSocket-Extensions header offer for this extension if the endpoint is in the role of a server. If the extension returns an empty string (""), the offer will not be included in the handshake.

Returns:String

the specific Sec-WebSocket-Extensions header for this extension

Since
1.3.5
isFrameValidback to summary
public void isFrameValid(Framedata inputFrame) throws InvalidDataException

Check if the received frame is correctly implemented by the other endpoint and there are no specification errors (like wrongly set RSV)

Parameters
inputFrame:Framedata

the received frame

Exceptions
InvalidDataException:
Throw InvalidDataException if the received frame is not correctly implementing the specification for the specific extension
Since
1.3.5
resetback to summary
public void reset()

Cleaning up internal stats when the draft gets reset.

Since
1.3.5
toStringback to summary
public String toString()

Return a string which should contain the class name as well as additional information about the current configurations for this extension (DEBUG purposes)

Returns:String

a string containing the class name as well as additional information

Since
1.3.5